vsch / flexmark-java

CommonMark/Markdown Java parser with source level AST. CommonMark 0.28, emulation of: pegdown, kramdown, markdown.pl, MultiMarkdown. With HTML to MD, MD to PDF, MD to DOCX conversion modules.
BSD 2-Clause "Simplified" License
2.21k stars 260 forks source link

Add highlight extension #594

Closed marcospereira closed 5 months ago

marcospereira commented 9 months ago

What

Adds a highlight extension as described here:

https://www.markdownguide.org/extended-syntax/#highlight

With this extension enabled, text like ==foo== will be rendered as <mark>foo</mark>. More about HTML mark element here:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark

Although this is an extended syntax, it is consistent with other extensions such as Footnotes and Heading IDs.

How

This was created by taking the InsExtension as an example, with the needed adjustments and tests.