From 63ebcb04b36d8ad3a38413a115c90dc731b0215d Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Sat, 18 Dec 2021 19:47:51 -0700 Subject: [PATCH 1/3] docs: fix docs color styling --- docs/source/conf.py | 2 +- docs/source/generate_style_list.py | 5 +-- docs/source/styles.rst | 54 +++++++++++++++--------------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 6494b1a..c53b98c 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,7 +13,7 @@ import os import sys -sys.path.insert(0, os.path.abspath(".")) +sys.path.insert(0, os.path.abspath("../..")) sys.path.append(os.path.abspath("extensions")) diff --git a/docs/source/generate_style_list.py b/docs/source/generate_style_list.py index 37e2de3..6f258ce 100644 --- a/docs/source/generate_style_list.py +++ b/docs/source/generate_style_list.py @@ -36,7 +36,7 @@ def generate_style_list(): ) style_heading = f"`{style}`\n" + "~" * len(f"`{style}`") output_example = indent_all_lines(full + "\n\n" + body_only) - style_list += f"{style_heading}\n\n::\n\n{output_example}\n\n" + style_list += f"{style_heading}\n\n.. code-block:: none\n\n{output_example}\n\n" # put it all together return f"{heading}\n\n{table_of_contents}\n{style_list}" @@ -49,4 +49,5 @@ def write_to_file(filename, content): if __name__ == "__main__": content = generate_style_list() - write_to_file(os.path.join("docs", "source", "styles.rst"), content) + write_to_file(os.path.join(os.path.dirname(__file__), "styles.rst"), content) + print("Successfully generated styles.rst") diff --git a/docs/source/styles.rst b/docs/source/styles.rst index 1572e72..e945461 100644 --- a/docs/source/styles.rst +++ b/docs/source/styles.rst @@ -8,7 +8,7 @@ Preset styles `ascii` ~~~~~~~ -:: +.. code-block:: none +-----+-----------------------+ | # | G H R S | @@ -29,7 +29,7 @@ Preset styles `ascii_borderless` ~~~~~~~~~~~~~~~~~~ -:: +.. code-block:: none # | G H R S ----- ----- ----- ----- ----- @@ -44,7 +44,7 @@ Preset styles `ascii_box` ~~~~~~~~~~~ -:: +.. code-block:: none +-----+-----+-----+-----+-----+ | # | G | H | R | S | @@ -65,7 +65,7 @@ Preset styles `ascii_compact` ~~~~~~~~~~~~~~~ -:: +.. code-block:: none +-----+-----------------------+ | # | G H R S | @@ -84,7 +84,7 @@ Preset styles `ascii_double` ~~~~~~~~~~~~~~ -:: +.. code-block:: none +-----+-----------------------+ | # | G H R S | @@ -105,7 +105,7 @@ Preset styles `ascii_minimalist` ~~~~~~~~~~~~~~~~~~ -:: +.. code-block:: none ----------------------------- # | G H R S @@ -126,7 +126,7 @@ Preset styles `ascii_simple` ~~~~~~~~~~~~~~ -:: +.. code-block:: none ===== ===== ===== ===== ===== # | G H R S @@ -145,7 +145,7 @@ Preset styles `borderless` ~~~~~~~~~~~~ -:: +.. code-block:: none # ┃ G H R S ━━━━━ ━━━━━ ━━━━━ ━━━━━ ━━━━━ @@ -160,7 +160,7 @@ Preset styles `double` ~~~~~~~~ -:: +.. code-block:: none ╔═════╦═══════════════════════╗ ║ # ║ G H R S ║ @@ -181,7 +181,7 @@ Preset styles `double_box` ~~~~~~~~~~~~ -:: +.. code-block:: none ╔═════╦═════╦═════╦═════╦═════╗ ║ # ║ G ║ H ║ R ║ S ║ @@ -202,7 +202,7 @@ Preset styles `double_compact` ~~~~~~~~~~~~~~~~ -:: +.. code-block:: none ╔═════╦═══════════════════════╗ ║ # ║ G H R S ║ @@ -221,7 +221,7 @@ Preset styles `double_thin_compact` ~~~~~~~~~~~~~~~~~~~~~ -:: +.. code-block:: none ╔═════╦═══════════════════════╗ ║ # ║ G H R S ║ @@ -240,7 +240,7 @@ Preset styles `markdown` ~~~~~~~~~~ -:: +.. code-block:: none | # | G | H | R | S | |-----|-----|-----|-----|-----| @@ -255,7 +255,7 @@ Preset styles `minimalist` ~~~~~~~~~~~~ -:: +.. code-block:: none ───────────────────────────── # │ G H R S @@ -276,7 +276,7 @@ Preset styles `simple` ~~~~~~~~ -:: +.. code-block:: none ═════ ═════ ═════ ═════ ═════ # ║ G H R S @@ -295,7 +295,7 @@ Preset styles `thick` ~~~~~~~ -:: +.. code-block:: none ┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ # ┃ G H R S ┃ @@ -316,7 +316,7 @@ Preset styles `thick_box` ~~~~~~~~~~~ -:: +.. code-block:: none ┏━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┓ ┃ # ┃ G ┃ H ┃ R ┃ S ┃ @@ -337,7 +337,7 @@ Preset styles `thick_compact` ~~~~~~~~~~~~~~~ -:: +.. code-block:: none ┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ # ┃ G H R S ┃ @@ -356,7 +356,7 @@ Preset styles `thin` ~~~~~~ -:: +.. code-block:: none ┌─────┬───────────────────────┐ │ # │ G H R S │ @@ -377,7 +377,7 @@ Preset styles `thin_box` ~~~~~~~~~~ -:: +.. code-block:: none ┌─────┬─────┬─────┬─────┬─────┐ │ # │ G │ H │ R │ S │ @@ -398,7 +398,7 @@ Preset styles `thin_compact` ~~~~~~~~~~~~~~ -:: +.. code-block:: none ┌─────┬───────────────────────┐ │ # │ G H R S │ @@ -417,7 +417,7 @@ Preset styles `thin_compact_rounded` ~~~~~~~~~~~~~~~~~~~~~~ -:: +.. code-block:: none ╭─────┬───────────────────────╮ │ # │ G H R S │ @@ -436,7 +436,7 @@ Preset styles `thin_double` ~~~~~~~~~~~~~ -:: +.. code-block:: none ┌─────┬───────────────────────┐ │ # │ G H R S │ @@ -457,7 +457,7 @@ Preset styles `thin_double_rounded` ~~~~~~~~~~~~~~~~~~~~~ -:: +.. code-block:: none ╭─────┬───────────────────────╮ │ # │ G H R S │ @@ -478,7 +478,7 @@ Preset styles `thin_rounded` ~~~~~~~~~~~~~~ -:: +.. code-block:: none ╭─────┬───────────────────────╮ │ # │ G H R S │ @@ -499,7 +499,7 @@ Preset styles `thin_thick` ~~~~~~~~~~~~ -:: +.. code-block:: none ┌─────┬───────────────────────┐ │ # │ G H R S │ @@ -520,7 +520,7 @@ Preset styles `thin_thick_rounded` ~~~~~~~~~~~~~~~~~~~~ -:: +.. code-block:: none ╭─────┬───────────────────────╮ │ # │ G H R S │ From 86abbbe31a6b3a571de037a5420e27f8817951e0 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Sat, 18 Dec 2021 22:32:37 -0700 Subject: [PATCH 2/3] docs: Added Fira Mono font --- docs/source/_static/css/custom.css | 9 ++++++++- docs/source/_templates/layout.html | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css index b25846c..8748fc1 100644 --- a/docs/source/_static/css/custom.css +++ b/docs/source/_static/css/custom.css @@ -24,6 +24,13 @@ a.icon.icon-home:visited { /* Change code highlight background on dark mode */ @media (prefers-color-scheme: dark) { .rst-content .highlight { - background: #26292b; + background: #26292b; } } + +/* Change code block font */ +.rst-content .linenodiv pre, +.rst-content div[class^="highlight"] pre, +.rst-content pre.literal-block { + font-family: Fira Mono, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace; +} diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html index a109bcb..99520df 100644 --- a/docs/source/_templates/layout.html +++ b/docs/source/_templates/layout.html @@ -40,6 +40,10 @@ + + + + {%- for cssfile in extra_css_files %} {%- endfor -%} From 85e7e19e785c79792383c5a4aa21a81e65c98e09 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Sat, 18 Dec 2021 22:58:35 -0700 Subject: [PATCH 3/3] docs: Change code font to Adobe Source Code Pro --- docs/source/_static/css/custom.css | 2 +- docs/source/_templates/layout.html | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css index 8748fc1..3f2cb7c 100644 --- a/docs/source/_static/css/custom.css +++ b/docs/source/_static/css/custom.css @@ -32,5 +32,5 @@ a.icon.icon-home:visited { .rst-content .linenodiv pre, .rst-content div[class^="highlight"] pre, .rst-content pre.literal-block { - font-family: Fira Mono, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace; + font-family: Source Code Pro, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, Courier, monospace; } diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html index 99520df..9e1b7e7 100644 --- a/docs/source/_templates/layout.html +++ b/docs/source/_templates/layout.html @@ -40,9 +40,7 @@ - - - + {%- for cssfile in extra_css_files %}