Add ==highlight== Syntax Support to remark-gfm #1444
Unanswered
fazi-gondal
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
@mikeal @rubys @isaacs @session-zz @fazi-gondal @wooorm
Feature Request: Add
==highlight==Syntax Support toremark-gfmProblem:
The
remark-gfmplugin does not natively support==text==syntax for highlighting text (rendered as<mark>in HTML), unlikemarkdown-itwith its highlight plugin. This creates inconsistency when migrating from Markdown-it or when users expect this common formatting option.Desired Behavior:
==highlighted text==should render as<mark>highlighted text</mark>==**bold** highlight==)Why This Matters:
==text==from other parsers.markdown-ittoremark.Proposed Solutions:
remark-gfm(ideal for ecosystem consistency).remark-highlight) if upstream adoption is unlikely.Example Implementation:
References:
markdown-it: markdown-it-markmicromarkextension example: micromark-extension-highlightTo add
==text==syntax highlighting to theremark-gfmplugin, you'll need to create a custom remark plugin that extends the markdown parser. Here's how to implement it:This implementation:
micromark-extension-highlightto parse==text==syntaxmdast-util-highlightto convert parsed tokens to<mark>nodes<mark>elements in HTMLThe syntax will work exactly like markdown-it's highlight plugin:
==highlighted text==<mark>highlighted text</mark>For CSS styling, add this to your stylesheet:
Key features:
==**bold** highlight==\==not highlighted==== multi-word highlight ==To customize the marker or HTML tag, modify the micromark extension configuration:
This solution matches the requested functionality while maintaining compatibility with remark-gfm and standard Markdown features.
Beta Was this translation helpful? Give feedback.
All reactions