Skip to content

Commit 9080720

Browse files
committed
documentation: Sphinx: change default role to code:easycrypt
The default role (`xxx`) is now set to the EasyCrypt code highlighter.
1 parent c148172 commit 9080720

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

doc/_static/easycrypt.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* Keep EasyCrypt inline role neutral (inherit text color). */
2+
code.easycrypt,
3+
code.code.easycrypt,
4+
code.code.highlight.easycrypt,
5+
span.easycrypt,
6+
span.code.easycrypt,
7+
span.code.highlight.easycrypt {
8+
color: inherit;
9+
}

doc/conf.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import pathlib
99
import sys
1010

11+
from docutils.parsers.rst import roles
1112
from sphinx.util import logging as sphinx_logging
13+
from sphinx.roles import code_role
1214

1315
# -- Project information -----------------------------------------------------
1416
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
@@ -32,9 +34,10 @@
3234
]
3335

3436
highlight_language = 'easycrypt'
37+
default_role = 'easycrypt'
3538

3639
templates_path = ['_templates']
37-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
40+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'global.rst']
3841

3942
# -- EasyCrypt proofs -------------------------------------------------------
4043

@@ -56,3 +59,16 @@
5659

5760
html_theme = 'sphinx_rtd_theme'
5861
html_static_path = ['_static']
62+
html_css_files = [
63+
'easycrypt.css',
64+
]
65+
66+
# -- EasyCrypt role ----------------------------------------------------------
67+
def _easycrypt_role(name, rawtext, text, lineno, inliner, options=None, content=()):
68+
options = {} if options is None else options.copy()
69+
options['language'] = 'easycrypt'
70+
return code_role(name, rawtext, text, lineno, inliner, options, content)
71+
72+
# -- Setup app ---------------------------------------------------------------
73+
def setup(app):
74+
app.add_role('easycrypt', _easycrypt_role)

0 commit comments

Comments
 (0)