A Markdown lexer for Pygments to highlight Markdown code snippets.
Pygments Markdown Lexer can be installed via pip install pygments-markdown-lexer
as usual,
see releases for an overview of available versions.
To get a bleeding-edge version from source, use these commands:
repo="jhermann/pygments-markdown-lexer"
pip install -r "https://raw.githubusercontent.com/$repo/master/requirements.txt"
pip install -UI -e "git+https://github.com/$repo.git#egg=${repo#*/}"
See Contributing on how to create a full development environment.
Once installed, usually into a virtualenv, the pygments_markdown_lexer
package
is instantly visible to Pygments, since it defines a Setuptools entry point
for registration.
In order for Sphinx to load and recognize the custom lexer, add the
pygments_markdown_lexer
package name to the extensions
list in conf.py
.
Then use it in a code-block
as if it were a built-in, like this:
.. code-block:: md
Enables _Pygments_ to handle
[Markdown](https://daringfireball.net/projects/markdown/syntax)
in *Sphinx* **code blocks**.
Both md
and markdown
are valid to specify the language for the code block.
To create a working directory for this project, call these commands:
git clone "https://github.com/jhermann/pygments-markdown-lexer.git"
cd "pygments-markdown-lexer"
. .env --yes --develop
invoke build --docs test check
Contributing to this project is easy, and reporting an issue or adding to the documentation also improves things for every user. You don’t need to be a developer to contribute. See CONTRIBUTING for more.
Specs
Tools
Packages
- Based in part on the
pygments.lexers.markup
lexers (Georg Brandl and others, BSD-licensed).