From 4f990e761575fb9e8fb2857ffb5acecd775e0037 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 25 Sep 2020 01:30:17 +0530 Subject: [PATCH] dev_guide: Add Pygments Lexer examples (#71458) * dev_guide: Add Pygments Lexer examples Fixes: #51307 Signed-off-by: Abhijeet Kasurde * adds ansible-output lexer, remmoves unsupported lexers Co-authored-by: Alicia Cozine --- .../rst/dev_guide/style_guide/index.rst | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/docsite/rst/dev_guide/style_guide/index.rst b/docs/docsite/rst/dev_guide/style_guide/index.rst index a50a3180e9080b..506b30592201aa 100644 --- a/docs/docsite/rst/dev_guide/style_guide/index.rst +++ b/docs/docsite/rst/dev_guide/style_guide/index.rst @@ -133,6 +133,40 @@ We use: """""""""""""""""""""""""""" +Syntax highlighting - Pygments +------------------------------ + +The Ansible documentation supports a range of `Pygments lexers `_ +for `syntax highlighting `_ 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 -------------------