use of com.vladsch.flexmark.util.ast.Node in project zeppelin by apache.
the class MarkdownParser method render.
public String render(String markdownText) {
Node document = parser.parse(markdownText);
String html = renderer.render(document);
return wrapWithMarkdownClassDiv(html);
}
use of com.vladsch.flexmark.util.ast.Node in project configuration-as-code-plugin by jenkinsci.
the class JenkinsConfiguredWithReadmeRule method transformFencedCodeBlockFromMarkdownToString.
private List<String> transformFencedCodeBlockFromMarkdownToString(InputStream markdownContent) throws IOException {
ArrayList<String> results = new ArrayList<>();
final MutableDataSet FORMAT_OPTIONS = new MutableDataSet();
FORMAT_OPTIONS.set(Parser.EXTENSIONS, OPTIONS.get(Parser.EXTENSIONS));
Reader targetReader = new InputStreamReader(markdownContent);
Node document = PARSER.parseReader(targetReader);
TextCollectingVisitor textCollectingVisitor = new TextCollectingVisitor();
Node fencedCodeBlock = document.getChildOfType(FencedCodeBlock.class);
while (fencedCodeBlock != null) {
results.add(textCollectingVisitor.collectAndGetText(fencedCodeBlock));
fencedCodeBlock = fencedCodeBlock.getNextAny(FencedCodeBlock.class);
}
return results;
}
Aggregations