Markdown PyCon
December 10, 2024 ยท View on GitHub
Markdown extension to parse pycon code blocks without indentation or fences.
Installation
pip install markdown-pycon
Configuration
This extension relies on the Highlight extension of PyMdown Extensions.
Configure from Python:
from markdown import Markdown
Markdown(extensions=["pycon"])
...or in MkDocs configuration file, as a Markdown extension:
# mkdocs.yml
markdown_extensions:
- pycon
Usage
In your Markdown documents, simply write your pycon code blocks
without indentation or fences (triple backticks):
>>> print("This is a pycon code block")
This is a pycon code block
This will get rendered as:
>>> print("This is a pycon code block")
This is a pycon code block
Doctest flags will be removed from the code lines.