Fix GitHub alert/callout blocks being dropped during normalization #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #11 - GitHub alert/callout blocks like
> [!NOTE]were being completely dropped during Markdown normalization, leaving only the content without the block quote formatting.Root Cause
Marko (the Markdown parser) recognizes GitHub-style alerts as a separate
Alertelement type (which extendsQuote). TheMarkdownNormalizerclass was missing arender_alertmethod, so alerts were not being rendered correctly.Changes
src/flowmark/formats/flowmark_markdown.pyrender_alert()method toMarkdownNormalizerclass> [!NOTE],> [!TIP], etc.)>prefixing[!note]→[!NOTE])tests/test_alerts.py(new file)tests/testdocs/testdoc.orig.mdValidation Plan
Automated Testing ✅
[!note]→[!NOTE][!NOOT],[!WARNUNG], etc. preserve quote[!CUSTOM],[!INFO]preserve quote[NOTE],[!NOTE,![NOTE]preserve quote>```pythoninside alert- iteminside alertLinting & Type Checking ✅
Code Review Checklist ✅
dedent()for multi-line strings in testsEdge Cases Verified ✅
> [!TYPE]header and content[!][NOTE](no !)[!NOTE(no ])Reviewer Notes
Type annotations: The
render_alertmethod usesblock.Quoteas the parameter type with# pyright: ignorebecause Marko'sAlertclass isn't in its type stubs. At runtime, the element is actuallygfm_elements.Alert.Robustness design: Unknown/misspelled alert types gracefully degrade to regular quotes via Marko's parser fallback. This means content is never lost - at worst, it becomes a regular quote instead of a styled alert.
Future alert types: The rendering code is flexible - it outputs whatever
alert_typeMarko parses. If Marko adds new types, they'll work automatically. The only limitation is Marko's parser regex which currently only matches the 5 standard GitHub types.