The Pygments Pseudocode Lexer¶
Site Contents:
- Version:
3.0
- Date:
2026-05-23
- Copyright:
© 2026 Franz Glasner
© 2015 Simon Wachter
- License:
MIT License
- Revision:
cd22c2e8390d
This package contains Pygments lexers for some variants of pseudocode.
Initially a fork of pygments-lexer-pseudocode it has been considerably changed and expanded.
It now contains the following lexers:
Language Name |
Description |
Extension(s) |
Aliases / Short Name(s) |
Lexer Class |
|---|---|---|---|---|
AlgPseudocode |
Pseudocode lexer inspired by CTAN’s Algpseudocodex |
*.algpseudocode, *.algpseudo |
algpseudocode, algpseudo |
AlgPseudocodeLexer |
AlgPseudocodeFR |
AlgPseudocode with french keyword expansion |
*.algpseudo-fr, *.algpseudocode-fr |
algpseudocode-fr, algpseudo-fr |
AlgPseudocodeLexer_FR |
AlgPseudocodeDE |
AlgPseudocode with german keyword expansion |
*.algpseudo-de, *.algpseudocode-de |
algpseudocode-de, algpseudo-de |
AlgPseudocodeLexer_DE |
FrPseudocode |
The original lexer from pygments-lexer-pseudocode – renamed and slightly changed |
*.fr-algo, *.fr-pseudocode |
fr-pseudocode, fr-pseudo, fr-algorithm, fr-algo |
FrPseudocodeLexer |
It additionally contains the following filters:
Filter Name |
Description |
Filter Class |
|---|---|---|
tokenreplace |
A configurable token replacer: replace a given token type by another given token type in a stream |
TokenReplaceFilter |
errortogenericerror |
Replace all |
ErrorToGenericErrorTokenFilter |
Installation¶
The lexers and filters are available as a Python wheel package:
pip install pygments-lexer-pseudocode2
Alternatively, to build from the source code repository:
python -m build
Usage¶
After installation all the Pseudocode lexers and filters automatically register itself with the plugin system of Pygments. Their respective aliases and filename extensions are made known to Pygments.
Usage is easy:
Pygmentizing a file with a known file extension:
pygmentize document.algpseudocodeOr you can manually select the Pseudocode lexer you want to use by using a command line flag:
pygmentize -l algpseudocode somefileWithin Sphinx use a lexer like this:
.. code-block:: algpseudocode
Licenses¶
The package is licensed under the terms of the MIT Licence.
Some code snippets are licensed under the terms of the BSD 2-Clause “Simplified” License as they are taken from the Python lexer that is included in Pygments.