use of com.vladsch.flexmark.ast.Node in project flexmark-java by vsch.
the class PdfConverter method main.
public static void main(String[] args) {
final String pegdown = "#Heading\n" + "-----\n" + "paragraph text \n" + "lazy continuation\n" + "\n" + "* list item\n" + " > block quote\n" + " lazy continuation\n" + "\n" + "~~~info\n" + " with uneven indent\n" + " with uneven indent\n" + "indented code\n" + "~~~ \n" + "\n" + " with uneven indent\n" + " with uneven indent\n" + " indented code\n" + "1. numbered item 1 \n" + "1. numbered item 2 \n" + "1. numbered item 3 \n" + " - bullet item 1 \n" + " - bullet item 2 \n" + " - bullet item 3 \n" + " 1. numbered sub-item 1 \n" + " 1. numbered sub-item 2 \n" + " 1. numbered sub-item 3 \n" + " \n" + " ~~~info\n" + " with uneven indent\n" + " with uneven indent\n" + " indented code\n" + " ~~~ \n" + " \n" + " with uneven indent\n" + " with uneven indent\n" + " indented code\n" + "";
System.out.println("pegdown\n");
System.out.println(pegdown);
final Parser PARSER = Parser.builder(OPTIONS).build();
final HtmlRenderer RENDERER = HtmlRenderer.builder(OPTIONS).build();
Node document = PARSER.parse(pegdown);
String html = RENDERER.render(document);
PdfConverterExtension.exportToPdf("/Users/vlad/src/pdf/flexmark-java.pdf", html, "", OPTIONS);
}
use of com.vladsch.flexmark.ast.Node 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.ast.Node in project flexmark-java by vsch.
the class PegdownToCommonMark method main.
// use the PARSER to parse and RENDERER to parse pegdown indentation rules and render CommonMark
public static void main(String[] args) {
final String pegdown = "#Heading\n" + "-----\n" + "paragraph text \n" + "lazy continuation\n" + "\n" + "* list item\n" + " > block quote\n" + " lazy continuation\n" + "\n" + "~~~info\n" + " with uneven indent\n" + " with uneven indent\n" + " indented code\n" + "~~~ \n" + "\n" + " with uneven indent\n" + " with uneven indent\n" + " indented code\n" + "1. numbered item 1 \n" + "1. numbered item 2 \n" + "1. numbered item 3 \n" + " - bullet item 1 \n" + " - bullet item 2 \n" + " - bullet item 3 \n" + " 1. numbered sub-item 1 \n" + " 1. numbered sub-item 2 \n" + " 1. numbered sub-item 3 \n" + " \n" + " ~~~info\n" + " with uneven indent\n" + " with uneven indent\n" + " indented code\n" + " ~~~ \n" + " \n" + " with uneven indent\n" + " with uneven indent\n" + " indented code\n" + "";
System.out.println("pegdown\n");
System.out.println(pegdown);
Node document = PARSER.parse(pegdown);
String commonmark = RENDERER.render(document);
System.out.println("\n\nCommonMark\n");
System.out.println(commonmark);
}
use of com.vladsch.flexmark.ast.Node 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.ast.Node 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);
}
Aggregations