follow-up #17692: more inline syntax highlighting (#17837)

This commit is contained in:
Andrey Makarov 2021-04-29 18:16:14 +03:00 • committed by GitHub
commit e61381a293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 287 additions and 181 deletions

View file

@ -1,6 +1,51 @@
..
Usage of this file:
Add this in the beginning of *.rst file::
.. default-role:: code
.. include:: rstcommon.rst
It's the current trick for brevity and compatibility with both Github and
rst2html.py, considering that Github cannot highlight Nim in
RST files anyway and it does not include files.
This way interpreted text is displayed with monospaced font in Github
and it's displayed an Nim code in both rst2html.py
(note ".. default-role:: Nim" above) and `nim rst2html`.
For files that are user manual and consist of stuff like cmdline
option description, use 'code' as a **real** default role:
.. include:: rstcommon.rst
.. default-role:: code
.. define language roles explicitly (for compatibility with rst2html.py):
.. role:: nim(code)
:language: nim
.. default-role:: nim
.. role:: c(code)
:language: c
.. role:: cpp(code)
:language: cpp
.. role:: yaml(code)
:language: yaml
.. role:: python(code)
:language: python
.. role:: java(code)
:language: java
.. role:: csharp(code)
:language: csharp
.. role:: cmd(code)
.. role:: program(code)
.. role:: option(code)