Skip to content
Snippets Groups Projects
Select Git revision
  • debian/master default
  • pristine-tar
  • upstream
  • debian/0.1.1-6
  • debian/0.1.1-5
  • debian/0.1.1-4
  • debian/0.1.1-3
  • debian/0.1.1-2
  • debian/0.1.1-1
  • upstream/0.1.1
10 results

python-ansible-pygments

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Olivier Gayot authored
    Signed-off-by: default avatarOlivier Gayot <olivier.gayot@sigexec.com>
    c8b6bbad
    History

    Pygments lexer and style Ansible snippets

    GitHub Actions CI/CD workflow Codecov badge

    This project provides a Pygments lexer that is able to handle Ansible output. It may be used anywhere Pygments is integrated. The lexer is registered globally under the name ansible-output.

    It also provides a Pygments style for tools needing to highlight code snippets.

    The code is licensed under the terms of the BSD 2-Clause license.

    Using the lexer in Sphinx

    Make sure this library in installed in the same env as your Sphinx automation via pip install ansible-pygments sphinx. Then, you should be able to use a lexer by its name ansible-output in the code blocks of your RST documents. For example:

    .. code-block:: ansible-output
    
        [WARNING]: Unable to find '/nosuchfile' in expected paths (use -vvvvv to see paths)
    
        ok: [localhost] => {
            "msg": ""
        }

    Using the style in Sphinx

    It is possible to just set ansible in conf.py and it will "just work", provided that this project is installed alongside Sphinx as shown above.

    pygments_style = 'ansible'