use of com.vladsch.flexmark.html.HtmlRenderer in project flexmark-java by vsch.
the class ParserTest method ioReaderTest.
@Test
public void ioReaderTest() throws IOException {
Parser parser = Parser.builder().build();
InputStream input1 = SpecReader.getSpecInputStream();
Node document1;
InputStreamReader reader = new InputStreamReader(input1, "utf-8");
document1 = parser.parseReader(reader);
String spec = SpecReader.readSpec();
Node document2 = parser.parse(spec);
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
assertEquals(renderer.render(document2), renderer.render(document1));
}
use of com.vladsch.flexmark.html.HtmlRenderer in project flexmark-java by vsch.
the class UsageExampleTest method parseAndRender.
@Test
public void parseAndRender() {
Parser parser = Parser.builder().build();
Node document = parser.parse("This is *Sparta*");
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
assertEquals("<p>This is <em>Sparta</em></p>\n", renderer.render(document));
}
use of com.vladsch.flexmark.html.HtmlRenderer 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);
}
Aggregations