blob: be0c447c859210b74a1e4b743bbbe4914acb2af3 (
plain) (
tree)
|
|
package com.terminaldweller.doc;
import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;
/** The markdown class which provides the markdown parser. */
public class Md {
/**
* Parses a markdown string and returns the result in html.
*
* @param markdown the string containing the markdown string.
* @return the rendered markdown document in html.
*/
public String mdparseService(String markdown) {
Parser parser = parser.builder().build();
Node document = parser.parse(markdown);
HtmlRenderer renderer = HtmlRenderer.builder().build();
return renderer.render(document);
}
}
|