dev_guide: Add Pygments Lexer examples (#71458)

* dev_guide: Add Pygments Lexer examples

Fixes: #51307

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* adds ansible-output lexer, remmoves unsupported lexers

Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com>
This commit is contained in:
Abhijeet Kasurde 2020-09-25 01:30:17 +05:30 committed by GitHub
parent 90134b0ac3
commit 4f990e7615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,6 +133,40 @@ We use:
""""""""""""""""""""""""""""
Syntax highlighting - Pygments
------------------------------
The Ansible documentation supports a range of `Pygments lexers <http://pygments.org/>`_
for `syntax highlighting <https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#code-examples>`_ to make our code examples look good. Each code-block must be correctly indented and surrounded by blank lines.
The Ansible documentation allows the following values:
* none (no highlighting)
* ansible-output (a custom lexer for Ansible output)
* bash
* console
* csharp
* ini
* json
* powershell
* python
* rst
* sh
* shell
* shell-session
* text
* yaml
* yaml+jinja
For example, you can highlight Python code using following syntax:
.. code-block:: rst
.. code-block:: python
def my_beautiful_python_code():
pass
Internal navigation
-------------------