Search in sources :

Example 86 with Node

use of com.vladsch.flexmark.ast.Node in project flexmark-java by vsch.

the class TextCollectingVisitorTest method test_inline_code.

@Test
public void test_inline_code() {
    Parser parser = Parser.builder().build();
    Node document = parser.parse("Test text `inline code`");
    TextCollectingVisitor collectingVisitor = new TextCollectingVisitor();
    final String text = collectingVisitor.collectAndGetText(document);
    assertEquals("Test text inline code", text);
}
Also used : Node(com.vladsch.flexmark.ast.Node) Parser(com.vladsch.flexmark.parser.Parser) Test(org.junit.Test)

Example 87 with Node

use of com.vladsch.flexmark.ast.Node in project nzbhydra2 by theotherp.

the class Markdown method renderMarkdownAsHtml.

public static String renderMarkdownAsHtml(String markdown) {
    MutableDataSet options = new MutableDataSet();
    Parser parser = Parser.builder(options).build();
    HtmlRenderer renderer = HtmlRenderer.builder(options).build();
    Node document = parser.parse(markdown);
    return renderer.render(document);
}
Also used : Node(com.vladsch.flexmark.ast.Node) HtmlRenderer(com.vladsch.flexmark.html.HtmlRenderer) MutableDataSet(com.vladsch.flexmark.util.options.MutableDataSet) Parser(com.vladsch.flexmark.parser.Parser)

Aggregations

Node (com.vladsch.flexmark.ast.Node)87 Parser (com.vladsch.flexmark.parser.Parser)29 HtmlRenderer (com.vladsch.flexmark.html.HtmlRenderer)21 Test (org.junit.Test)19 MutableDataSet (com.vladsch.flexmark.util.options.MutableDataSet)14 DataHolder (com.vladsch.flexmark.util.options.DataHolder)11 List (java.util.List)8 BasedSequence (com.vladsch.flexmark.util.sequence.BasedSequence)6 MutableDataHolder (com.vladsch.flexmark.util.options.MutableDataHolder)5 Text (com.vladsch.flexmark.ast.Text)3 TextCollectingVisitor (com.vladsch.flexmark.ast.util.TextCollectingVisitor)3 Extension (com.vladsch.flexmark.Extension)2 Block (com.vladsch.flexmark.ast.Block)2 CustomNode (com.vladsch.flexmark.ast.CustomNode)2 Document (com.vladsch.flexmark.ast.Document)2 Heading (com.vladsch.flexmark.ast.Heading)2 DocxRenderer (com.vladsch.flexmark.docx.converter.internal.DocxRenderer)2 MacroClose (com.vladsch.flexmark.ext.xwiki.macros.MacroClose)2 AstCollectingVisitor (com.vladsch.flexmark.test.AstCollectingVisitor)2 Attributes (com.vladsch.flexmark.util.html.Attributes)2