@Incubating
public class MarkdownDocument
extends Object
implements Iterable
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.
| Constructor and description |
|---|
MarkdownDocument(List<Map<String, Object>> nodes) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public List<Map<String, Object>> |
getCodeBlocks()All fenced and indented code blocks anywhere in the document. |
|
public List<Map<String, Object>> |
getHeadings()All headings anywhere in the document, in document order. |
|
public List<Map<String, Object>> |
getLinks()All links anywhere in the document. |
|
public List<Map<String, Object>> |
getNodes()The raw top-level nodes of the document. |
|
public List<Map<String, Object>> |
getTables()All tables anywhere in the document. |
|
public String |
getText()Plain-text projection of the document — formatting markers are stripped and block-level elements are separated by newlines. |
|
public Iterator<Map<String, Object>> |
iterator() |
|
public List<Map<String, Object>> |
section(String headingText)Return the nodes under the heading with the given text, up to the next heading of the same or higher level. |
All fenced and indented code blocks anywhere in the document.
All headings anywhere in the document, in document order.
All tables anywhere in the document. Tables are only produced when
enableTables(true) was set on the slurper.
Plain-text projection of the document — formatting markers are stripped and block-level elements are separated by newlines.
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.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.