use of com.vladsch.flexmark.util.data.MutableDataSet 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