webberzone.dev Recent

Content_Importer class Pro only

Content_Importer

Content Importer class.

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

Methods

convert()

Convert markdown body to post_content.

Since: 3.1.0
Line: 35

public function convert( string $body, bool $use_block_editor = ..., bool $toc_from_frontmatter = ... ): string;
TypeNameDescription
string$bodyMarkdown content (after frontmatter stripped).
bool$use_block_editorWhether to output Gutenberg blocks (auto-detected when omitted).
bool$toc_from_frontmatterWhether 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:

  • Scalar values: key: value or key: “quoted value”
  • YAML flow arrays: key: [a, b, c]
  • YAML block sequences (multi-line): key: - item1 - item2

Aliases are normalised to canonical keys after parsing.

Since: 3.1.0
Line: 260

public function parse_frontmatter( string $content ): array;
TypeNameDescription
string$contentRaw 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: 395

public function html_to_blocks( string $html ): string;
TypeNameDescription
string$htmlRaw HTML from markdown parser.

Returns: string — Block-serialized HTML.