pygments-markdown-lexer

Pygments Markdown Lexer – A Markdown lexer for Pygments to highlight Markdown code snippets.


Keywords
hosted, by, github, pygments, markdown, lexer, highlighting, pygments-lexer, syntax-highlighting
License
Apache-2.0
Install
pip install pygments-markdown-lexer==0.1.0.dev0

Documentation

pygments-markdown-lexer

A Markdown lexer for Pygments to highlight Markdown code snippets.

Travis CICoverallsGitHub IssuesLicenseDevelopment StatusLatest Version

Installation

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.

Usage

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.

Contributing

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.

References

Specs

Tools

Packages

Acknowledgements

  • Based in part on the pygments.lexers.markup lexers (Georg Brandl and others, BSD-licensed).