test(markdown): add comprehensive test suite for markdown parser#166
test(markdown): add comprehensive test suite for markdown parser#166adrianschmidt-bot wants to merge 1 commit intojgroth:mainfrom
Conversation
Expands test coverage from ~20 to 94 tests, covering: - Basic elements (paragraphs, headings, links, images, lists, blockquotes) - Inline formatting (bold, italic, code, strikethrough) - Code blocks (language detection, whitespace, escaping) - Tables (structure, alignment) - Frontmatter (extraction, complex YAML, edge cases) - Admonitions (all types, nested content) - Type links (known/unknown types, unions, arrays, generics) - Edge cases (empty input, unicode, escaped chars, deep nesting) - Integration scenario (complete documentation page) Also documents a quirk: types get linked inside fenced code blocks because the parent.parent check doesn't work with flatMap traversal.
📝 WalkthroughWalkthroughThis PR reorganizes and expands a markdown test suite, transforming focused frontmatter tests into comprehensive "basic elements" coverage. New test categories include admonitions, type linking, raw HTML passthrough, edge cases, and end-to-end integration scenarios across 583 added lines. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/kompendium/test/markdown.spec.ts`:
- Around line 281-305: The markdownToHtml pipeline is missing the remark-gfm
plugin so tables and alignment aren’t rendered; update the markdownToHtml
implementation to register remark-gfm with the unified/remark pipeline (where
remark-parse/unified are used) so that table syntax and alignment produce
<table>, <th>, <td> and align="..." attributes instead of the current output;
ensure remark-gfm is imported/required and added to the processor chain before
transforming to HTML.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai review |
|
Tip For best results, initiate chat on the files or code changes.
Excellent work on the comprehensive test suite! 🎉 🧠 Learnings used |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
@jgroth: @adrianschmidt-bot accidentally created this PR because I was clear as mud when I meant to ask it to create tests for the markdownParser in lime-elements. The tests in lime-elements have been added and merged by now, but should we add these more comprehensive tests here too?
In lime-elements I actually had the bot make the tests a lot stricter, testing exact html output structure, so that we'll see exactly what changes when we update the dependencies or fiddle with the config. Do we want to be as strict here? It will mean we'll have to update the tests to match reality for much smaller changes to the output, but doing that has just gone from very time consuming and annoying to extremely quick and simple with the advent of competent AI bots, so I'd say we should. But it's up to you.
Summary
Expands test coverage for
markdownToHtml()from ~20 to 94 tests.What's Covered
Basic Elements
Inline Formatting
Code Blocks
kompendium-codecomponent<code>Tables
Frontmatter
file.data.frontmatterAdmonitions
Type Links
Edge Cases
Integration
Notes
Documents one quirk: types get linked even inside fenced code blocks. The
typeLinksplugin attempts to skip<pre><code>blocks via aparent.parentcheck, but this doesn't work withflatMaptraversal. Not a regression — just documenting existing behavior.Summary by CodeRabbit