Hello Community.
How would you recommend parsing and presenting Markdown formatted text in IDE using a plugin?
Potential flow:
- get markdown formatted text from API,
- convert it to HTML with org.jetbrains:markdown and show using JBHtmlPanel
- show code fragments in markdown using com.intellij.openapi.editor.ex.EditorEx to get syntax highlighting.
On the markdown plugin usage -
Sample code from GitHub - JetBrains/markdown: Markdown parser written in kotlin :
final String src = "Some *Markdown*";
final MarkdownFlavourDescriptor flavour = new GFMFlavourDescriptor();
final ASTNode parsedTree = new MarkdownParser(flavour).buildMarkdownTreeFromString(text);
final String html = new HtmlGenerator(src, parsedTree, flavour, false).generateHtml();
generateHtml
requires ASTNode
, ASTNode
, Iterable<CharSequence?>
.
Is there a minimal working Java code?
Thank you!