Skip to content

Commit

Permalink
dev_guide: Add Pygments Lexer examples (ansible#71458)
Browse files Browse the repository at this point in the history
* dev_guide: Add Pygments Lexer examples

Fixes: ansible#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>
  • Loading branch information
Akasurde and acozine committed Sep 24, 2020
1 parent 90134b0 commit 4f990e7
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/docsite/rst/dev_guide/style_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------------

Expand Down

0 comments on commit 4f990e7

Please sign in to comment.