Recent

Content_ImporterclassPro only

Content_Importer

Content Importer class.

Namespace: WebberZone\Knowledge_Base\Pro\GitHub
Since: 3.1.0
Source: includes/pro/github/class-content-importer.php line 23

Methods

escape_shortcodes() static

Rewrite literal shortcode text to the double-bracket form.

[[shortcode]] is the only form that survives a Markdown round trip: WordPress renders it as the literal [shortcode], and re-importing it yields the same double-bracket source. Backslash escapes do not survive, because Parsedown consumes them, so \[shortcode\] is normalised here too.

Only registered shortcode tags are rewritten, so WP-CLI optional-argument notation such as [--force] and placeholders such as wzkb_rated_[article_id] are left alone. Matching is done with get_shortcode_regex() so an enclosing shortcode is wrapped as [[tag]content[/tag]], the form WordPress unescapes; a standalone [/tag] is not matched and never executes on its own.

Since: 3.1.3
Line: 45

static public function escape_shortcodes( string $text ): string;
Type Name Description
string $text Text that may contain literal shortcodes.

Returns: string — Text with literal shortcodes in double-bracket form.

convert()

Convert markdown body to post_content.

Since: 3.1.0
Line: 116

public function convert( string $body, bool $use_block_editor = ..., bool $toc_from_frontmatter = ... ): string;
Type Name Description
string $body Markdown content (after frontmatter stripped).
bool $use_block_editor Whether to output Gutenberg blocks (auto-detected when omitted).
bool $toc_from_frontmatter Whether frontmatter requested a TOC (inserts token before first heading when no [toc] marker present).

Returns: string — Post content suitable for wp_insert_post().

parse_frontmatter()

Parse YAML frontmatter from a markdown file.

Supports scalars, flow arrays (key: [a, b, c]), and block sequences; aliases are normalised to canonical keys after parsing.

Since: 3.1.0
Line: 328

public function parse_frontmatter( string $content ): array;
Type Name Description
string $content Raw file content.

Returns: array — array<string,mixed>, body: string}

html_to_blocks()

Wrap HTML with Gutenberg block delimiters.

Ported from docs-updater/to-blocks.php.

Since: 3.1.0
Line: 466

public function html_to_blocks( string $html ): string;
Type Name Description
string $html Raw HTML from markdown parser.

Returns: string — Block-serialized HTML.