-
Beta Was this translation helpful? Give feedback.
Answered by
adrgs
Mar 11, 2023
Replies: 2 comments 2 replies
-
@palla-lin You can use the Markdown renderer in v3. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Here's a short snippet of Python code that will do that, in case anyone else is interested: import mistune # pip install mistune==3.0.0rc4
from mistune.renderers.markdown import MarkdownRenderer
markdown_content = """# Heading 1
## Heading 2
### Heading 3"""
markdown_ast = mistune.create_markdown(renderer=None)
ast_markdown = MarkdownRenderer()
results, state = markdown_ast.parse(markdown_content)
# modify results AST
result = ast_markdown(results, state)
print(result) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lepture
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a short snippet of Python code that will do that, in case anyone else is interested: