Package groovy.markdown
Class MarkdownDocument
java.lang.Object
groovy.markdown.MarkdownDocument
A parsed Markdown document, exposed as a list of node maps with convenience
accessors for the most common navigation patterns.
Each node is a Map with at least a type key. The raw structure
supports all standard Groovy list/map operations (e.g. findAll,
each, *.text); the convenience accessors below recursively
walk the tree so nested code blocks, links, etc. are included.
- Since:
- 6.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAll fenced and indented code blocks anywhere in the document.All headings anywhere in the document, in document order.getLinks()All links anywhere in the document.getNodes()The raw top-level nodes of the document.All tables anywhere in the document.getText()Plain-text projection of the document — formatting markers are stripped and block-level elements are separated by newlines.iterator()Return the nodes under the heading with the given text, up to the next heading of the same or higher level.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MarkdownDocument
-
-
Method Details
-
getNodes
The raw top-level nodes of the document. -
iterator
-
getCodeBlocks
All fenced and indented code blocks anywhere in the document. -
getHeadings
All headings anywhere in the document, in document order. -
getLinks
All links anywhere in the document. -
getTables
All tables anywhere in the document. Tables are only produced whenenableTables(true)was set on the slurper. -
getText
Plain-text projection of the document — formatting markers are stripped and block-level elements are separated by newlines. -
section
Return the nodes under the heading with the given text, up to the next heading of the same or higher level. The heading itself is not included. Returns an empty list if no matching heading is found.Only top-level headings are considered; headings nested inside block quotes or list items are not searched, since the section boundary concept does not naturally extend to such positions.
-