You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #9. The initial Markpub parser PR added behavioral tests for the top-level structure and several block handlers (paragraph, heading, code, image, separator, filter, classic content, empty/null return) but left a number of block-handler branches untested. This issue tracks filling those gaps before we rely on the parser more heavily.
Background
During review of #9, the test-coverage pass flagged several branches where a regression would ship silently because the existing assertions (assertStringContainsString) would still pass. The PR addressed the highest-impact correctness bugs; this issue addresses the remaining coverage.
Test Plan
Tests live in tests/phpunit/tests/content-parser/class-test-markpub.php.
Convert existing assertStringContainsString assertions to assertSame on exact markdown output where the format is contract (separator block, fenced code, heading line). This catches block-ordering and whitespace regressions that currently slip through.
test_html_to_markdown_filter — verify the filter callback receives $content as the second argument (document the two-arg contract).
Out of Scope
Adding a core/table handler ('table' extension was dropped in Add Markpub content parser #9; re-introduce alongside handler).
Link target/title attribute support.
Support for classic-content block-level HTML (<h1>, <ul>, etc.). inline_html_to_markdown() only handles inline markup today.
Summary
Follow-up to #9. The initial Markpub parser PR added behavioral tests for the top-level structure and several block handlers (paragraph, heading, code, image, separator, filter, classic content, empty/null return) but left a number of block-handler branches untested. This issue tracks filling those gaps before we rely on the parser more heavily.
Background
During review of #9, the test-coverage pass flagged several branches where a regression would ship silently because the existing assertions (
assertStringContainsString) would still pass. The PR addressed the highest-impact correctness bugs; this issue addresses the remaining coverage.Test Plan
Tests live in
tests/phpunit/tests/content-parser/class-test-markpub.php.Priority 1 — untested block handlers (high risk of silent regression)
listing()— ordered list<!-- wp:list {"ordered":true} -->with 3core/list-iteminner blocks."1. First\n2. Second\n3. Third"(useassertSameon the markdown).listing()— unordered listordered. Assert"- First\n- Second\n- Third".listing()— skips empty items but keeps counter correct"1. First\n2. Third"(counter must not gap to3.).listing()— inline formatting preserved inside items<strong>bold</strong>. Assert"- **bold**"appears.quote()—innerBlocksbranchcore/quotewrapping acore/paragraph. Assert"> Paragraph text".quote()— multi-line prefixingcore/quotewrapping two inner paragraphs. Assert each line carries"> "prefix.quote()—innerHTMLfallback branchcore/quotewith noinnerBlocks, justinnerHTML. Assert quote-prefixed markdown.container()—core/group,core/columns,core/column\n\nseparator.fallback()— delegates tocontainer()wheninnerBlockspresentPriority 2 — untested branches inside covered handlers
image()— returnsnullwhen no<img>tag foundparse()returnsnull(or block is absent from output).heading()— default level whenattrs.levelmissing<!-- wp:heading -->with no attrs. Assert leading"## ".heading()— returns null for whitespace-only content<br>or whitespace. Assert parse returns null (or heading omitted).paragraph()— returns null for whitespace-only content (mirror of heading test).code()— language attribute emitted in fence<!-- wp:code {"language":"php"} -->. Assert output starts with```php\n.code()— HTML-entity decoding<div>. Assert decoded form appears in fence.<a href="https://en.wikipedia.org/wiki/Foo_(bar)">text</a>.%28bar%29, not raw(bar).<br>hard break conversionline1<br>line2. Assert output contains"line1 \nline2"(two spaces + newline).&,’. Assert decoded forms appear.<img src="x.jpg" alt="x">. Assertin output (distinct fromcore/imageblock path).<strong>bold <em>italic</em></strong>. Assert**bold *italic***.Priority 3 — assertion-strength upgrades
assertStringContainsStringassertions toassertSameon exact markdown output where the format is contract (separator block, fenced code, heading line). This catches block-ordering and whitespace regressions that currently slip through.test_html_to_markdown_filter— verify the filter callback receives$contentas the second argument (document the two-arg contract).Out of Scope
core/tablehandler ('table'extension was dropped in Add Markpub content parser #9; re-introduce alongside handler).<h1>,<ul>, etc.).inline_html_to_markdown()only handles inline markup today.