-
Notifications
You must be signed in to change notification settings - Fork 63
Closed
Labels
Description
I have the following markdown:
---
title: my title
author: bob marley
---
# Header {#identifier .class key=value}
Some text
::: {#special .glossary}
Term 1
: Definition 1
Term 2
: Definition 2
:::
I try to parse and stringify the individual terms and definitons of the definition lists with panflute
as follows:
import panflute as pf
def action(elem, doc):
if isinstance(elem, pf.Div):
for definition_item in elem.content[0].content:
# print(pf.stringify(definition_item.term))
print(pf.stringify(definition_item.definitions[0]))
def debug():
with open("definition-lists.md") as fs:
markdown = fs.read()
doc = pf.convert_text(markdown, standalone=True)
doc.walk(action)
if __name__ == "__main__":
debug()
It seems that the definition print out fine, but uncommenting line 6 in the python code results in the following error:
AttributeError: 'ListContainer' object has no attribute 'walk'
So I suspect it is not possible to stringify ListContainers
like that.
How can I obtain the terms of my definition list using panflute
? Thanks.