Determines the XML children node indices for every XML node at the highest level of xml
by interpreting Markdown heading levels (1–6).
Value
A list of integer vectors of the same length as the number of XML nodes at the highest level of xml
.
Details
commonmark::markdown_xml()
(and so md_to_xml()
which builds upon it) do parse (R) Markdown file content according to the
CommonMark specification, but do not return any information about the document's heading hierarchy.
md_xml_subnode_ix()
fills this gap by giving the hierarchy structure in the form of the XML subnode indices for every node at the highest level of xml
.
Examples
"# A title
Some prose.
## A subtitle
More prose.
## Another subtitle
Out of prose here.
### A sub-subtitle
I'm dug in.
# Another title
A last word." |>
pal::md_to_xml() |>
pal::md_xml_subnode_ix()
#> [[1]]
#> [1] 2 3 4 5 6 7 8
#>
#> [[2]]
#> integer(0)
#>
#> [[3]]
#> [1] 4
#>
#> [[4]]
#> integer(0)
#>
#> [[5]]
#> [1] 6 7 8
#>
#> [[6]]
#> integer(0)
#>
#> [[7]]
#> [1] 8
#>
#> [[8]]
#> integer(0)
#>
#> [[9]]
#> [1] 10
#>
#> [[10]]
#> integer(0)
#>