Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ansible-community/ansible-pygments
Provides Pygments highlighter for Ansible output for use in Sphinx
https://github.com/ansible-community/ansible-pygments
ansible lexer pygments pygments-lexer sphinx sphinx-extension
Last synced: 21 days ago
JSON representation
Provides Pygments highlighter for Ansible output for use in Sphinx
- Host: GitHub
- URL: https://github.com/ansible-community/ansible-pygments
- Owner: ansible-community
- License: other
- Created: 2021-06-01T06:29:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-07T07:46:50.000Z (3 months ago)
- Last Synced: 2024-10-06T22:04:31.315Z (about 1 month ago)
- Topics: ansible, lexer, pygments, pygments-lexer, sphinx, sphinx-extension
- Language: Python
- Homepage: https://pypi.org/p/ansible-pygments
- Size: 197 KB
- Stars: 5
- Watchers: 7
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![๐งช GitHub Actions CI/CD workflow tests badge]][GHA workflow runs list]
[![pre-commit.ci status badge]][pre-commit.ci results page]
[![Codecov badge]][Codecov coverage page]# [Pygments] lexer and style Ansible snippets
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:```rst
.. 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.```python
pygments_style = 'ansible'
```[Codecov badge]:
https://img.shields.io/codecov/c/github/ansible-community/ansible-pygments
[Codecov coverage page]:
https://codecov.io/gh/ansible-community/ansible-pygments[๐งช GitHub Actions CI/CD workflow tests badge]:
https://github.com/ansible-community/ansible-pygments/actions/workflows/ci-cd.yml/badge.svg?branch=main&event=push
[GHA workflow runs list]: https://github.com/ansible-community/ansible-pygments/actions/workflows/ci-cd.yml?query=branch%3Amain[pre-commit.ci results page]:
https://results.pre-commit.ci/latest/github/ansible-community/ansible-pygments/main
[pre-commit.ci status badge]:
https://results.pre-commit.ci/badge/github/ansible-community/ansible-pygments/main.svg[Ansible]: https://www.ansible.com/?utm_medium=github-or-pypi&utm_source=ansible-pygments--readme
[Pygments]: https://pygments.org
[Sphinx]: https://www.sphinx-doc.org
[BSD 2-Clause license]: https://opensource.org/licenses/BSD-2-Clause