Package groovy.markdown
Class MarkdownSlurper
java.lang.Object
groovy.markdown.MarkdownSlurper
Parses CommonMark Markdown into a
MarkdownDocument backed by nested lists and maps.
Usage:
def doc = new groovy.markdown.MarkdownSlurper().parseText('# Hello')
assert doc.headings[0].text == 'Hello'
GFM-style tables are supported via an optional extension. Call
enableTables(true) after adding
org.commonmark:commonmark-ext-gfm-tables to the runtime classpath.- Since:
- 6.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionenableTables(boolean enable) Enable GFM-style tables.parse(InputStream stream)
-
Constructor Details
-
MarkdownSlurper
public MarkdownSlurper()
-
-
Method Details
-
enableTables
Enable GFM-style tables. Requirescommonmark-ext-gfm-tableson the classpath.- Parameters:
enable- whether to enable table parsing- Returns:
- this slurper for chaining
- Throws:
MarkdownRuntimeException- ifenableis true but the extension jar is missing
-
parseText
-
parse
-
parse
-
parse
- Throws:
IOException
-
parse
- Throws:
IOException
-