use of com.vladsch.flexmark.html.HtmlRenderer in project flexmark-java by vsch.
the class PegdownOptions2 method main.
public static void main(String[] args) {
final MutableDataHolder OPTIONS = PegdownOptionsAdapter.flexmarkOptions(Extensions.ALL - (headerLinks ? 0 : Extensions.ANCHORLINKS) - (hardwrap ? 0 : Extensions.HARDWRAPS) + (allowHtml ? 0 : Extensions.SUPPRESS_ALL_HTML)).toMutable();
final Parser PARSER = Parser.builder(OPTIONS).build();
final HtmlRenderer RENDERER = HtmlRenderer.builder(OPTIONS).build();
String input = "[[test page]]" + "";
Node node = PARSER.parse(input);
System.out.println(RENDERER.render(node));
}
use of com.vladsch.flexmark.html.HtmlRenderer in project flexmark-java by vsch.
the class ProfileEmulationFamilySamples method markdown.
void markdown() {
MutableDataSet options = new MutableDataSet();
options.setFrom(ParserEmulationProfile.MARKDOWN);
Parser parser = Parser.builder(options).build();
HtmlRenderer renderer = HtmlRenderer.builder(options).build();
Node document = parser.parse("This is *Sparta*");
// "<p>This is <em>Sparta</em></p>\n"
renderer.render(document);
}
use of com.vladsch.flexmark.html.HtmlRenderer in project flexmark-java by vsch.
the class SyntheticLinkSample method main.
public static void main(String[] args) {
MutableDataSet options = new MutableDataSet();
// set optional extensions
options.set(Parser.EXTENSIONS, Arrays.asList(SyntheticLinkExtension.create()));
// uncomment to convert soft-breaks to hard breaks
// options.set(HtmlRenderer.SOFT_BREAK, "<br />\n");
Parser parser = Parser.builder(options).build();
HtmlRenderer renderer = HtmlRenderer.builder(options).build();
// You can re-use parser and renderer instances
Node document = parser.parse("Some markdown content");
String html = renderer.render(document);
System.out.println(html);
}
use of com.vladsch.flexmark.html.HtmlRenderer in project flexmark-java by vsch.
the class TitleExtract method main.
public static void main(String[] args) {
Parser parser = Parser.builder(OPTIONS).build();
HtmlRenderer renderer = HtmlRenderer.builder(OPTIONS).build();
// You can re-use parser and renderer instances
Node document = parser.parse("\n" + "# Plugin commit-message-length-validator\n" + "\n" + "Vendor\n" + ": Gerrit Code Review\n" + "\n" + "Version\n" + ": v2.15-rc2\n" + "\n" + "commitmessage.maxSubjectLength\n" + ": Maximum length of the commit message's subject line. Defaults\n" + " to 50 if not specified or less than 0.\n" + "\n" + "## About\n" + "\n" + "This plugin checks the length of a commit's commit message subject and body, and reports warnings and errors to the git client if the lentghts are exceeded.\n" + "\n" + "## Documentation\n" + "\n" + "* [Commit Message Length Configuration](config.md)\n" + "* More Items\n" + "\n" + "");
String title = findTitle(document);
System.out.println("Title: " + title + "\n");
// "<p>This is <em>Sparta</em></p>\n"
String html = renderer.render(document);
System.out.println(html);
}
use of com.vladsch.flexmark.html.HtmlRenderer in project flexmark-java by vsch.
the class ComboParserTest method testWrap.
// @Test
public void testWrap() throws Exception {
if (!example.isFullSpecExample())
return;
final HtmlRenderer RENDERER = HtmlRenderer.builder(OPTIONS).build();
final Parser PARSER = Parser.builder(OPTIONS).build();
String source = readResource("/wrap.md");
String html = readResource("/wrap.html");
assertRendering(source, html);
}
Aggregations