com.vladsch.flexmark.util.ast.Document Java Examples

The following examples show how to use com.vladsch.flexmark.util.ast.Document. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MarkdownEngine.java    From jbake with MIT License 6 votes vote down vote up
@Override
public void processBody(final ParserContext context) {
    List<String> mdExts = context.getConfig().getMarkdownExtensions();

    int extensions = PegdownExtensions.NONE;

    for (String ext : mdExts) {
        if (ext.startsWith("-")) {
            ext = ext.substring(1);
            extensions = removeExtension(extensions, extensionFor(ext));
        } else {
            if (ext.startsWith("+")) {
                ext = ext.substring(1);
            }
            extensions = addExtension(extensions, extensionFor(ext));
        }
    }

    DataHolder options = PegdownOptionsAdapter.flexmarkOptions(extensions);

    Parser parser = Parser.builder(options).build();
    HtmlRenderer renderer = HtmlRenderer.builder(options).build();

    Document document = parser.parse(context.getBody());
    context.setBody(renderer.render(document));
}
 
Example #2
Source File: FlexmarkMarkDownProcessorImpl.java    From maven-confluence-plugin with Apache License 2.0 3 votes vote down vote up
/**
 *
 * @param content
 * @return
 */
@Override
public String processMarkdown( MarkdownParserContext context, final String content) throws IOException {

    final Parser parser = Parser.builder(FlexmarkConfluenceWikiVisitor.OPTIONS()).build();

    final Document doc = parser.parse( content );

    throw new UnsupportedOperationException("Flexmark parser is not implememnted yet!");

}