Simple use of flexmark-java to convert Markdown to HTML with options settings compatible with Markdown Navigator parser options.
Two parameters control the option configuration: ForUseBy
enum allows selecting the following
Markdown Navigator context:
PARSER
equivalent to parsing for generating PsiTree and syntax highlightingJAVAFX
equivalent to generating HTML for JavaFX WebView browserSWING
equivalent to generating HTML for Swing browserHTML
equivalent to generating the HTML plain HTML text
The other parameter is a set of options that emulate Markdown Navigator parser settings, with defaults set to mimick GFM Document compatibility.
Nothing is stopping you from modifying the MutableDataSet
returned by the static options()
method to customize the options to your requirements.
Keep in mind that Markdown Navigator provides custom link resolver to convert document relative and site absolute links to actual files. This is not available outside of the plugin and if desired must be implemented according to your project requirements via a flexmark-java extension.
Similarly none of the style sheets, java scripts or other necessary HTML document elements are
generated. These are left to the discretion of the user. This can be accomplished by wrapping
the rendered HTML with desired text or through a flexmark-java extension implementing a
PhasedNodeRenderer
which will generate the necessary HTML for different parts of the HTML
document.
Emoji shortcut rendering requires emoji-cheat-sheet.com image file location to be provided for emoji image URL generation. If the directory is not set then emoji shortcuts will be converted to GitHub emoji URLs for testing purposes.
By default parsing allows more flexible table parsing than allowed by GFM but for rendering purposes options are set to emulate GFM table parsing.