From da386b560a322e5ba9ca38e9b40b7044ceea8354 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 12 Nov 2019 18:18:41 -0800 Subject: docs: use nicer looking code blocks in docs (#13708) - [x] Use higher contrast terminal output font - [x] Use higher contrast code block background color than default - [x] Use a noticeable prompt character See also https://github.com/spack/spack-tutorial/pull/10. --- lib/spack/docs/conf.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index e5305a9317..06b993efb5 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -176,7 +176,25 @@ exclude_patterns = ['_build', '_spack_root', '.spack-env'] #show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +# We use our own extension of the default style with a few modifications +from pygments.style import Style +from pygments.styles.default import DefaultStyle +from pygments.token import Generic, Comment, Text + +class SpackStyle(DefaultStyle): + styles = DefaultStyle.styles.copy() + background_color = "#f4f4f8" + styles[Generic.Output] = "#355" + styles[Generic.Prompt] = "bold #346ec9" + +import pkg_resources +dist = pkg_resources.Distribution(__file__) +sys.path.append('.') # make 'conf' module findable +ep = pkg_resources.EntryPoint.parse('spack = conf:SpackStyle', dist=dist) +dist._ep_map = {'pygments.styles': {'plugin1': ep}} +pkg_resources.working_set.add(dist) + +pygments_style = 'spack' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] -- cgit v1.2.3-60-g2f50