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;
| 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:
- 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;
| 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: 395
public function html_to_blocks( string $html ): string;
| Type | Name | Description |
|---|---|---|
string | $html | Raw HTML from markdown parser. |
Returns: string — Block-serialized HTML.