mkdocs-primer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. mkdocs_primer-0.1.0/.gitignore +16 -0
  2. mkdocs_primer-0.1.0/LICENSE +21 -0
  3. mkdocs_primer-0.1.0/PKG-INFO +115 -0
  4. mkdocs_primer-0.1.0/README.md +89 -0
  5. mkdocs_primer-0.1.0/mkdocs_primer/404.html +11 -0
  6. mkdocs_primer-0.1.0/mkdocs_primer/__init__.py +20 -0
  7. mkdocs_primer-0.1.0/mkdocs_primer/base.html +168 -0
  8. mkdocs_primer-0.1.0/mkdocs_primer/css/pygments.css +121 -0
  9. mkdocs_primer-0.1.0/mkdocs_primer/css/theme.css +544 -0
  10. mkdocs_primer-0.1.0/mkdocs_primer/css/vendor/LICENSE +21 -0
  11. mkdocs_primer-0.1.0/mkdocs_primer/css/vendor/primer-core.css +12 -0
  12. mkdocs_primer-0.1.0/mkdocs_primer/css/vendor/primer-markdown.css +7 -0
  13. mkdocs_primer-0.1.0/mkdocs_primer/css/vendor/primitives-base.css +304 -0
  14. mkdocs_primer-0.1.0/mkdocs_primer/css/vendor/primitives-dark.css +1934 -0
  15. mkdocs_primer-0.1.0/mkdocs_primer/css/vendor/primitives-light.css +1934 -0
  16. mkdocs_primer-0.1.0/mkdocs_primer/img/favicon.svg +3 -0
  17. mkdocs_primer-0.1.0/mkdocs_primer/js/back-to-top.js +23 -0
  18. mkdocs_primer-0.1.0/mkdocs_primer/js/color-mode.js +50 -0
  19. mkdocs_primer-0.1.0/mkdocs_primer/js/copy-code.js +59 -0
  20. mkdocs_primer-0.1.0/mkdocs_primer/main.html +1 -0
  21. mkdocs_primer-0.1.0/mkdocs_primer/mkdocs_theme.yml +42 -0
  22. mkdocs_primer-0.1.0/mkdocs_primer/partials/color-mode.html +21 -0
  23. mkdocs_primer-0.1.0/mkdocs_primer/partials/footer.html +31 -0
  24. mkdocs_primer-0.1.0/mkdocs_primer/partials/header.html +37 -0
  25. mkdocs_primer-0.1.0/mkdocs_primer/partials/language.html +49 -0
  26. mkdocs_primer-0.1.0/mkdocs_primer/partials/nav-item.html +31 -0
  27. mkdocs_primer-0.1.0/mkdocs_primer/partials/nav.html +5 -0
  28. mkdocs_primer-0.1.0/mkdocs_primer/partials/pagination.html +16 -0
  29. mkdocs_primer-0.1.0/mkdocs_primer/partials/search-box.html +9 -0
  30. mkdocs_primer-0.1.0/mkdocs_primer/search.html +27 -0
  31. mkdocs_primer-0.1.0/mkdocs_primer_mike/__init__.py +16 -0
  32. mkdocs_primer-0.1.0/mkdocs_primer_mike/css/version-select.css +19 -0
  33. mkdocs_primer-0.1.0/mkdocs_primer_mike/js/version-select.js +98 -0
  34. mkdocs_primer-0.1.0/package.json +15 -0
  35. mkdocs_primer-0.1.0/pyproject.toml +59 -0
  36. mkdocs_primer-0.1.0/scripts/vendor-css.mjs +107 -0
@@ -0,0 +1,16 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ .venv/
8
+
9
+ # Node — only needed to refresh mkdocs_primer/css/vendor/
10
+ node_modules/
11
+
12
+ # MkDocs
13
+ site/
14
+
15
+ # Agent working notes, local to a checkout
16
+ /.agents/TODO.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oleg Shulyakov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.5
2
+ Name: mkdocs-primer
3
+ Version: 0.1.0
4
+ Summary: A MkDocs theme built on GitHub's Primer design system
5
+ Project-URL: Homepage, https://github.com/olegshulyakov/mkdocs-primer
6
+ Project-URL: Source, https://github.com/olegshulyakov/mkdocs-primer
7
+ Project-URL: Issues, https://github.com/olegshulyakov/mkdocs-primer/issues
8
+ Author-email: Oleg Shulyakov <oleg.shulyakov@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: documentation,github,mkdocs,mkdocs-theme,primer
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Web Environment
14
+ Classifier: Framework :: MkDocs
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Topic :: Documentation
21
+ Classifier: Topic :: Software Development :: Documentation
22
+ Requires-Python: >=3.9
23
+ Requires-Dist: mkdocs>=1.6
24
+ Requires-Dist: pygments>=2.16
25
+ Description-Content-Type: text/markdown
26
+
27
+ # mkdocs-primer
28
+
29
+ A [MkDocs](https://www.mkdocs.org/) theme built on [GitHub's Primer design system](https://primer.style/) — documentation that looks like it belongs on GitHub.
30
+
31
+ ## Install
32
+
33
+ ```console
34
+ $ pip install mkdocs-primer
35
+ ```
36
+
37
+ ```yaml
38
+ # mkdocs.yml
39
+ theme:
40
+ name: primer
41
+ ```
42
+
43
+ ## Features
44
+
45
+ - GitHub's `.markdown-body` rendering — the same typography, tables and code chrome as a README on github.com.
46
+ - Light and dark modes via Primer's color primitives, with an auto/light/dark toggle that remembers the visitor's choice. Defaults to following the OS.
47
+ - Syntax highlighting mapped onto Primer's `prettylights` variables, so code colors follow the color mode. Works with both `pymdownx.highlight` and `codehilite`.
48
+ - Copy buttons for Pygments code blocks and an accessible back-to-top control that respects reduced-motion preferences.
49
+ - Admonitions styled after GitHub's alerts. The `admonition` extension ships no CSS and `@primer/css` has no rule for it, so most themes render `!!! note` undecorated.
50
+ - Sidebar navigation with unlimited nesting, prev/next links, a search results page, and a 404 page.
51
+ - "Improve this page" footer, as in the Jekyll theme, with a "Last updated" line when `mkdocs-git-revision-date-localized` is enabled.
52
+ - Native support for the plugins that need it: `mkdocs-section-index` (section labels render as links) and `mkdocs-static-i18n` (translated pages get the right `<html lang>` and can use the header language selector). See [Plugins](https://olegshulyakov.github.io/mkdocs-primer/guide/plugins/).
53
+
54
+ ## Configuration
55
+
56
+ | Option | Default | Description |
57
+ | --- | --- | --- |
58
+ | `logo` | `null` | Image shown beside the site name, relative to `docs_dir`. |
59
+ | `favicon` | `img/favicon.svg` | Site icon. |
60
+ | `include_sidebar` | `true` | Render the navigation sidebar. |
61
+ | `show_footer` | `true` | Render the "Improve this page" footer. |
62
+ | `color_mode` | `auto` | Initial color mode: `auto`, `light` or `dark`. |
63
+ | `light_theme` | `light` | Primer theme used in light mode. |
64
+ | `dark_theme` | `dark` | Primer theme used in dark mode. |
65
+
66
+ For GitHub's hover anchors next to headings, enable the `toc` extension with a leading permalink carrying Primer's `anchor` class:
67
+
68
+ ```yaml
69
+ markdown_extensions:
70
+ - toc:
71
+ permalink: ""
72
+ permalink_class: anchor
73
+ permalink_leading: true
74
+ ```
75
+
76
+ (The empty `permalink` is deliberate — the theme supplies the octicon, and it keeps a stray `¶` out of your search results.)
77
+
78
+ See the [documentation](https://olegshulyakov.github.io/mkdocs-primer/) for the rest.
79
+
80
+ ## Development
81
+
82
+ For the package release procedure, see [RELEASING.md](RELEASING.md).
83
+
84
+ The CSS under `mkdocs_primer/css/vendor/` is copied from `@primer/css` and `@primer/primitives` and **committed**, so installing the theme needs no Node toolchain.
85
+ To refresh it after bumping a version in `package.json`:
86
+
87
+ ```console
88
+ $ npm install
89
+ $ npm run vendor
90
+ ```
91
+
92
+ CI fails if those committed files drift from the pinned versions.
93
+
94
+ To preview the demo site:
95
+
96
+ ```console
97
+ $ pip install -e . -r requirements-docs.txt
98
+ $ mkdocs serve
99
+ ```
100
+
101
+ The demo site doubles as the theme's plugin compatibility test: `mkdocs.yml` enables every plugin that needs something from a theme, and CI builds it with `--strict`.
102
+ Those plugins need Python 3.10+, so CI checks the theme's own floor of 3.9 against a plugin-free site.
103
+
104
+ A few plugins cannot share that config — `rss` and `gen-files` both break under `static-i18n` — so they get their own sites under `examples/`, published beside the main one.
105
+ Build them after it, since `mkdocs build` cleans `site/`:
106
+
107
+ ```console
108
+ $ mkdocs build --strict
109
+ $ mkdocs build --strict -f examples/rss/mkdocs.yml
110
+ $ mkdocs build --strict -f examples/gen-files/mkdocs.yml
111
+ ```
112
+
113
+ ## License
114
+
115
+ MIT. Vendored Primer CSS is MIT, Copyright (c) GitHub, Inc. — see `mkdocs_primer/css/vendor/LICENSE`.
@@ -0,0 +1,89 @@
1
+ # mkdocs-primer
2
+
3
+ A [MkDocs](https://www.mkdocs.org/) theme built on [GitHub's Primer design system](https://primer.style/) — documentation that looks like it belongs on GitHub.
4
+
5
+ ## Install
6
+
7
+ ```console
8
+ $ pip install mkdocs-primer
9
+ ```
10
+
11
+ ```yaml
12
+ # mkdocs.yml
13
+ theme:
14
+ name: primer
15
+ ```
16
+
17
+ ## Features
18
+
19
+ - GitHub's `.markdown-body` rendering — the same typography, tables and code chrome as a README on github.com.
20
+ - Light and dark modes via Primer's color primitives, with an auto/light/dark toggle that remembers the visitor's choice. Defaults to following the OS.
21
+ - Syntax highlighting mapped onto Primer's `prettylights` variables, so code colors follow the color mode. Works with both `pymdownx.highlight` and `codehilite`.
22
+ - Copy buttons for Pygments code blocks and an accessible back-to-top control that respects reduced-motion preferences.
23
+ - Admonitions styled after GitHub's alerts. The `admonition` extension ships no CSS and `@primer/css` has no rule for it, so most themes render `!!! note` undecorated.
24
+ - Sidebar navigation with unlimited nesting, prev/next links, a search results page, and a 404 page.
25
+ - "Improve this page" footer, as in the Jekyll theme, with a "Last updated" line when `mkdocs-git-revision-date-localized` is enabled.
26
+ - Native support for the plugins that need it: `mkdocs-section-index` (section labels render as links) and `mkdocs-static-i18n` (translated pages get the right `<html lang>` and can use the header language selector). See [Plugins](https://olegshulyakov.github.io/mkdocs-primer/guide/plugins/).
27
+
28
+ ## Configuration
29
+
30
+ | Option | Default | Description |
31
+ | --- | --- | --- |
32
+ | `logo` | `null` | Image shown beside the site name, relative to `docs_dir`. |
33
+ | `favicon` | `img/favicon.svg` | Site icon. |
34
+ | `include_sidebar` | `true` | Render the navigation sidebar. |
35
+ | `show_footer` | `true` | Render the "Improve this page" footer. |
36
+ | `color_mode` | `auto` | Initial color mode: `auto`, `light` or `dark`. |
37
+ | `light_theme` | `light` | Primer theme used in light mode. |
38
+ | `dark_theme` | `dark` | Primer theme used in dark mode. |
39
+
40
+ For GitHub's hover anchors next to headings, enable the `toc` extension with a leading permalink carrying Primer's `anchor` class:
41
+
42
+ ```yaml
43
+ markdown_extensions:
44
+ - toc:
45
+ permalink: ""
46
+ permalink_class: anchor
47
+ permalink_leading: true
48
+ ```
49
+
50
+ (The empty `permalink` is deliberate — the theme supplies the octicon, and it keeps a stray `¶` out of your search results.)
51
+
52
+ See the [documentation](https://olegshulyakov.github.io/mkdocs-primer/) for the rest.
53
+
54
+ ## Development
55
+
56
+ For the package release procedure, see [RELEASING.md](RELEASING.md).
57
+
58
+ The CSS under `mkdocs_primer/css/vendor/` is copied from `@primer/css` and `@primer/primitives` and **committed**, so installing the theme needs no Node toolchain.
59
+ To refresh it after bumping a version in `package.json`:
60
+
61
+ ```console
62
+ $ npm install
63
+ $ npm run vendor
64
+ ```
65
+
66
+ CI fails if those committed files drift from the pinned versions.
67
+
68
+ To preview the demo site:
69
+
70
+ ```console
71
+ $ pip install -e . -r requirements-docs.txt
72
+ $ mkdocs serve
73
+ ```
74
+
75
+ The demo site doubles as the theme's plugin compatibility test: `mkdocs.yml` enables every plugin that needs something from a theme, and CI builds it with `--strict`.
76
+ Those plugins need Python 3.10+, so CI checks the theme's own floor of 3.9 against a plugin-free site.
77
+
78
+ A few plugins cannot share that config — `rss` and `gen-files` both break under `static-i18n` — so they get their own sites under `examples/`, published beside the main one.
79
+ Build them after it, since `mkdocs build` cleans `site/`:
80
+
81
+ ```console
82
+ $ mkdocs build --strict
83
+ $ mkdocs build --strict -f examples/rss/mkdocs.yml
84
+ $ mkdocs build --strict -f examples/gen-files/mkdocs.yml
85
+ ```
86
+
87
+ ## License
88
+
89
+ MIT. Vendored Primer CSS is MIT, Copyright (c) GitHub, Inc. — see `mkdocs_primer/css/vendor/LICENSE`.
@@ -0,0 +1,11 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block htmltitle %}404 - {{ config.site_name }}{% endblock %}
4
+
5
+ {% block content %}
6
+ <h1>404</h1>
7
+ <p>Sorry, this page could not be found.</p>
8
+ <p><a href="{{ nav.homepage.url | url if nav.homepage else base_url }}">Back to the home page</a></p>
9
+ {% endblock %}
10
+
11
+ {% block pagination %}{% endblock %}
@@ -0,0 +1,20 @@
1
+ """The `primer` MkDocs theme.
2
+
3
+ This package is templates, CSS and one small script — there is no Python API to
4
+ call. It exists so that MkDocs can find the theme through the
5
+ `mkdocs.themes` entry point declared in `pyproject.toml`:
6
+
7
+ ```toml
8
+ [project.entry-points."mkdocs.themes"]
9
+ primer = "mkdocs_primer"
10
+ ```
11
+
12
+ MkDocs resolves that entry point to this package's directory and loads
13
+ `mkdocs_theme.yml` from it for the theme's default options. Selecting the theme
14
+ is therefore all the wiring a site needs:
15
+
16
+ ```yaml
17
+ theme:
18
+ name: primer
19
+ ```
20
+ """
@@ -0,0 +1,168 @@
1
+ <!DOCTYPE html>
2
+ {#
3
+ The three data-* attributes are all required: @primer/primitives scopes each
4
+ theme with selectors like
5
+ [data-color-mode="auto"][data-light-theme="light"]
6
+ so setting data-color-mode alone leaves every variable undefined.
7
+ #}
8
+ {#
9
+ `i18n_page_locale` is put on the page context by mkdocs-static-i18n. That
10
+ plugin only rewrites `theme.locale` for the themes it ships support for, so a
11
+ third-party theme that reads `theme.locale` alone labels every translated
12
+ page as the default language.
13
+ #}
14
+ <html lang="{{ i18n_page_locale | default(config.theme.locale, true) }}"
15
+ dir="{{ config.theme.direction }}"
16
+ data-color-mode="{{ config.theme.color_mode }}"
17
+ data-light-theme="{{ config.theme.light_theme }}"
18
+ data-dark-theme="{{ config.theme.dark_theme }}">
19
+ <head>
20
+ <meta charset="utf-8">
21
+ <meta name="viewport" content="width=device-width, initial-scale=1">
22
+
23
+ {%- block site_meta %}
24
+ {%- if page and page.meta.description %}
25
+ <meta name="description" content="{{ page.meta.description }}">
26
+ {%- elif config.site_description %}
27
+ <meta name="description" content="{{ config.site_description }}">
28
+ {%- endif %}
29
+ {%- if config.site_author %}
30
+ <meta name="author" content="{{ config.site_author }}">
31
+ {%- endif %}
32
+ {%- if page and page.canonical_url %}
33
+ <link rel="canonical" href="{{ page.canonical_url }}">
34
+ {%- endif %}
35
+ {%- if config.theme.favicon %}
36
+ <link rel="icon" href="{{ config.theme.favicon | url }}">
37
+ {%- endif %}
38
+ {#
39
+ mkdocs-rss-plugin writes the feeds but leaves discovery to the theme,
40
+ so without these a reader has no way to find them. The filenames are a
41
+ plugin option, hence reading them back off the plugin config.
42
+ #}
43
+ {%- set rss_plugin = config.plugins.get('rss') %}
44
+ {%- if rss_plugin %}
45
+ <link rel="alternate" type="application/rss+xml"
46
+ title="{{ config.site_name }} — recently updated"
47
+ href="{{ rss_plugin.config.feeds_filenames.rss_updated | url }}">
48
+ <link rel="alternate" type="application/rss+xml"
49
+ title="{{ config.site_name }} — recently created"
50
+ href="{{ rss_plugin.config.feeds_filenames.rss_created | url }}">
51
+ {%- endif %}
52
+ {%- endblock %}
53
+
54
+ <title>{% block htmltitle %}{% if page and page.title and not page.is_homepage %}{{ page.title }} - {% endif %}{{ config.site_name }}{% endblock %}</title>
55
+
56
+ {%- block styles %}
57
+ {# Size/spacing/typography tokens first: Primer consumes them without fallbacks. #}
58
+ {%- if config.theme.font and config.theme.font.source %}
59
+ <link rel="stylesheet" href="{{ config.theme.font.source | url }}">
60
+ {%- endif %}
61
+ <link rel="stylesheet" href="{{ 'css/vendor/primitives-base.css' | url }}">
62
+ <link rel="stylesheet" href="{{ 'css/vendor/primitives-light.css' | url }}">
63
+ <link rel="stylesheet" href="{{ 'css/vendor/primitives-dark.css' | url }}">
64
+ <link rel="stylesheet" href="{{ 'css/vendor/primer-core.css' | url }}">
65
+ <link rel="stylesheet" href="{{ 'css/vendor/primer-markdown.css' | url }}">
66
+ <link rel="stylesheet" href="{{ 'css/pygments.css' | url }}">
67
+ <link rel="stylesheet" href="{{ 'css/theme.css' | url }}">
68
+ {%- if config.theme.font and (config.theme.font.text or config.theme.font.code) %}
69
+ <style>
70
+ :root {
71
+ {%- if config.theme.font.text %}
72
+ --fontStack-sansSerif: {{ config.theme.font.text }};
73
+ --fontStack-sansSerifDisplay: {{ config.theme.font.text }};
74
+ --fontStack-system: {{ config.theme.font.text }};
75
+ {%- endif %}
76
+ {%- if config.theme.font.code %}
77
+ --fontStack-monospace: {{ config.theme.font.code }};
78
+ {%- endif %}
79
+ }
80
+ </style>
81
+ {%- endif %}
82
+ {%- for path in config.extra_css %}
83
+ <link rel="stylesheet" href="{{ path | url }}">
84
+ {%- endfor %}
85
+ {%- endblock %}
86
+
87
+ {#
88
+ Applies the stored color mode before first paint. Must stay inline and
89
+ blocking, otherwise a dark-mode visitor gets a flash of the light theme.
90
+ #}
91
+ <script>
92
+ (function () {
93
+ try {
94
+ var mode = localStorage.getItem('mkdocs-primer-color-mode')
95
+ if (mode) document.documentElement.setAttribute('data-color-mode', mode)
96
+ } catch (e) {}
97
+ })()
98
+ </script>
99
+
100
+ {%- block extrahead %}{% endblock %}
101
+ </head>
102
+
103
+ <body>
104
+ <a href="#primer-content" class="sr-only">Skip to content</a>
105
+
106
+ {%- block header %}
107
+ {% include "partials/header.html" %}
108
+ {%- endblock %}
109
+
110
+ <div class="primer-layout container-xl px-3">
111
+ {%- block site_nav %}
112
+ {%- if config.theme.include_sidebar and nav %}
113
+ <aside class="primer-sidebar" aria-label="Site navigation">
114
+ {% include "partials/nav.html" %}
115
+ </aside>
116
+ {%- endif %}
117
+ {%- endblock %}
118
+
119
+ <main class="primer-main" id="primer-content">
120
+ <article class="markdown-body">
121
+ {%- block content %}
122
+ {{ page.content }}
123
+ {%- endblock %}
124
+ </article>
125
+
126
+ {%- block pagination %}
127
+ {% include "partials/pagination.html" %}
128
+ {%- endblock %}
129
+
130
+ {%- block footer %}
131
+ {%- if config.theme.show_footer %}
132
+ {% include "partials/footer.html" %}
133
+ {%- endif %}
134
+ {%- endblock %}
135
+ </main>
136
+ </div>
137
+
138
+ <button class="btn btn-octicon primer-back-to-top" type="button"
139
+ data-primer-back-to-top hidden aria-label="Back to top" title="Back to top">
140
+ {%- if config.theme.icon == 'lucide' %}
141
+ <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg>
142
+ {%- else %}
143
+ <svg aria-hidden="true" height="16" viewBox="0 0 16 16" width="16" fill="currentColor">
144
+ <path d="M8 1a.75.75 0 0 1 .53.22l5 5a.75.75 0 0 1-1.06 1.06L8.75 3.56V14.5a.75.75 0 0 1-1.5 0V3.56L3.53 7.28a.75.75 0 0 1-1.06-1.06l5-5A.75.75 0 0 1 8 1Z"></path>
145
+ </svg>
146
+ {%- endif %}
147
+ </button>
148
+
149
+ {%- block scripts %}
150
+ {#
151
+ Unconditional: the search plugin is not the only consumer. Anything
152
+ added through `extra_javascript` reads it too — mike's version selector
153
+ is one — and those scripts have no way to know whether search happens to
154
+ be enabled.
155
+ #}
156
+ <script>var base_url = {{ base_url | tojson }}</script>
157
+ <script src="{{ 'js/color-mode.js' | url }}" defer></script>
158
+ <script src="{{ 'js/copy-code.js' | url }}" defer></script>
159
+ <script src="{{ 'js/back-to-top.js' | url }}" defer></script>
160
+ {%- if 'search' in config.plugins %}
161
+ <script src="{{ 'search/main.js' | url }}" defer></script>
162
+ {%- endif %}
163
+ {%- for script in config.extra_javascript %}
164
+ {{ script | script_tag }}
165
+ {%- endfor %}
166
+ {%- endblock %}
167
+ </body>
168
+ </html>
@@ -0,0 +1,121 @@
1
+ /*
2
+ * Pygments tokens mapped onto Primer's --color-prettylights-syntax-* variables.
3
+ *
4
+ * Those variables are defined in both the light and dark primitives, so this
5
+ * single file gives GitHub's exact syntax colors in either color mode — there
6
+ * is no separate dark stylesheet to keep in sync.
7
+ *
8
+ * Both wrappers are covered because which one appears depends on the user's
9
+ * markdown_extensions: `.highlight` (pymdownx.highlight, fenced_code) and
10
+ * `.codehilite` (codehilite).
11
+ */
12
+
13
+ /* Primer styles `.markdown-body .highlight pre` already; match it for codehilite. */
14
+ .markdown-body .codehilite {
15
+ margin-bottom: var(--base-size-16);
16
+ }
17
+
18
+ .markdown-body .codehilite pre {
19
+ padding: var(--base-size-16);
20
+ margin-bottom: 0;
21
+ overflow: auto;
22
+ font-size: 85%;
23
+ line-height: 1.45;
24
+ color: var(--fgColor-default);
25
+ word-break: normal;
26
+ background-color: var(--bgColor-muted);
27
+ border-radius: 6px;
28
+ }
29
+
30
+ /* Highlighted line (pymdownx `hl_lines`). */
31
+ :is(.highlight, .codehilite) .hll {
32
+ background-color: var(--bgColor-attention-muted);
33
+ }
34
+
35
+ /* Line numbers. */
36
+ :is(.highlight, .codehilite) :is(.lineno, .linenos, .gl) {
37
+ color: var(--fgColor-muted);
38
+ user-select: none;
39
+ }
40
+
41
+ /* Comments. */
42
+ :is(.highlight, .codehilite) :is(.c, .ch, .cd, .cm, .cp, .cpf, .c1, .cs, .gp) {
43
+ color: var(--color-prettylights-syntax-comment);
44
+ }
45
+
46
+ /* Keywords. */
47
+ :is(.highlight, .codehilite) :is(.k, .kd, .kp, .kr, .kt) {
48
+ color: var(--color-prettylights-syntax-keyword);
49
+ }
50
+
51
+ /* Imports and other storage modifiers. */
52
+ :is(.highlight, .codehilite) .kn {
53
+ color: var(--color-prettylights-syntax-storage-modifier-import);
54
+ }
55
+
56
+ /* Constants: numbers, booleans, builtins, symbols. */
57
+ :is(.highlight, .codehilite)
58
+ :is(.kc, .m, .mb, .mf, .mh, .mi, .il, .mo, .nb, .bp, .no, .ni, .na, .ss, .o, .ow) {
59
+ color: var(--color-prettylights-syntax-constant);
60
+ }
61
+
62
+ /* Strings. */
63
+ :is(.highlight, .codehilite) :is(.s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .s1) {
64
+ color: var(--color-prettylights-syntax-string);
65
+ }
66
+
67
+ :is(.highlight, .codehilite) .sr {
68
+ color: var(--color-prettylights-syntax-string-regexp);
69
+ }
70
+
71
+ /* Entities: function, class, decorator and exception names. */
72
+ :is(.highlight, .codehilite) :is(.nf, .fm, .nc, .nd, .ne) {
73
+ color: var(--color-prettylights-syntax-entity);
74
+ }
75
+
76
+ /* Markup tags (HTML/XML). */
77
+ :is(.highlight, .codehilite) .nt {
78
+ color: var(--color-prettylights-syntax-entity-tag);
79
+ }
80
+
81
+ /* Variables and namespaces. */
82
+ :is(.highlight, .codehilite) :is(.nv, .vc, .vg, .vi, .vm, .nn, .nl) {
83
+ color: var(--color-prettylights-syntax-variable);
84
+ }
85
+
86
+ /* Errors. */
87
+ :is(.highlight, .codehilite) :is(.err, .gr) {
88
+ color: var(--color-prettylights-syntax-invalid-illegal-text);
89
+ background-color: var(--color-prettylights-syntax-invalid-illegal-bg);
90
+ }
91
+
92
+ /* Diff output. */
93
+ :is(.highlight, .codehilite) .gd {
94
+ color: var(--color-prettylights-syntax-markup-deleted-text);
95
+ background-color: var(--color-prettylights-syntax-markup-deleted-bg);
96
+ }
97
+
98
+ :is(.highlight, .codehilite) .gi {
99
+ color: var(--color-prettylights-syntax-markup-inserted-text);
100
+ background-color: var(--color-prettylights-syntax-markup-inserted-bg);
101
+ }
102
+
103
+ :is(.highlight, .codehilite) :is(.gh, .gu) {
104
+ color: var(--color-prettylights-syntax-markup-heading);
105
+ font-weight: var(--base-text-weight-semibold, 600);
106
+ }
107
+
108
+ :is(.highlight, .codehilite) .gt {
109
+ color: var(--color-prettylights-syntax-meta-diff-range);
110
+ }
111
+
112
+ /* Emphasis in markup lexers. */
113
+ :is(.highlight, .codehilite) .ge {
114
+ color: var(--color-prettylights-syntax-markup-italic);
115
+ font-style: italic;
116
+ }
117
+
118
+ :is(.highlight, .codehilite) .gs {
119
+ color: var(--color-prettylights-syntax-markup-bold);
120
+ font-weight: var(--base-text-weight-semibold, 600);
121
+ }