mkdocs-primer 0.1.2__tar.gz → 0.2.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 (64) hide show
  1. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/PKG-INFO +11 -3
  2. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/README.md +10 -2
  3. mkdocs_primer-0.2.0/mkdocs_primer/404.html +12 -0
  4. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/base.html +77 -22
  5. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/css/pygments.css +20 -0
  6. mkdocs_primer-0.2.0/mkdocs_primer/css/theme.css +1232 -0
  7. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/js/copy-code.js +30 -7
  8. mkdocs_primer-0.2.0/mkdocs_primer/js/disclosure.js +59 -0
  9. mkdocs_primer-0.2.0/mkdocs_primer/js/nav-sections.js +46 -0
  10. mkdocs_primer-0.2.0/mkdocs_primer/js/scrollable.js +40 -0
  11. mkdocs_primer-0.2.0/mkdocs_primer/js/toc-active.js +65 -0
  12. mkdocs_primer-0.2.0/mkdocs_primer/locales/en/LC_MESSAGES/messages.mo +0 -0
  13. mkdocs_primer-0.2.0/mkdocs_primer/locales/en/LC_MESSAGES/messages.po +156 -0
  14. mkdocs_primer-0.2.0/mkdocs_primer/locales/es/LC_MESSAGES/messages.mo +0 -0
  15. mkdocs_primer-0.2.0/mkdocs_primer/locales/es/LC_MESSAGES/messages.po +156 -0
  16. mkdocs_primer-0.2.0/mkdocs_primer/locales/fr/LC_MESSAGES/messages.mo +0 -0
  17. mkdocs_primer-0.2.0/mkdocs_primer/locales/fr/LC_MESSAGES/messages.po +157 -0
  18. mkdocs_primer-0.2.0/mkdocs_primer/locales/hi/LC_MESSAGES/messages.mo +0 -0
  19. mkdocs_primer-0.2.0/mkdocs_primer/locales/hi/LC_MESSAGES/messages.po +156 -0
  20. mkdocs_primer-0.2.0/mkdocs_primer/locales/messages.pot +153 -0
  21. mkdocs_primer-0.2.0/mkdocs_primer/locales/pt/LC_MESSAGES/messages.mo +0 -0
  22. mkdocs_primer-0.2.0/mkdocs_primer/locales/pt/LC_MESSAGES/messages.po +156 -0
  23. mkdocs_primer-0.2.0/mkdocs_primer/locales/ru/LC_MESSAGES/messages.mo +0 -0
  24. mkdocs_primer-0.2.0/mkdocs_primer/locales/ru/LC_MESSAGES/messages.po +157 -0
  25. mkdocs_primer-0.2.0/mkdocs_primer/locales/zh/LC_MESSAGES/messages.mo +0 -0
  26. mkdocs_primer-0.2.0/mkdocs_primer/locales/zh/LC_MESSAGES/messages.po +154 -0
  27. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/mkdocs_theme.yml +10 -0
  28. mkdocs_primer-0.2.0/mkdocs_primer/partials/breadcrumbs.html +33 -0
  29. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/partials/color-mode.html +2 -1
  30. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/partials/footer.html +10 -4
  31. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/partials/header.html +19 -11
  32. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/partials/language.html +15 -4
  33. mkdocs_primer-0.2.0/mkdocs_primer/partials/nav-item.html +47 -0
  34. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/partials/pagination.html +8 -3
  35. mkdocs_primer-0.2.0/mkdocs_primer/partials/search-box.html +38 -0
  36. mkdocs_primer-0.2.0/mkdocs_primer/partials/toc-item.html +16 -0
  37. mkdocs_primer-0.2.0/mkdocs_primer/partials/toc-list.html +9 -0
  38. mkdocs_primer-0.2.0/mkdocs_primer/partials/toc.html +72 -0
  39. mkdocs_primer-0.2.0/mkdocs_primer/search.html +142 -0
  40. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/pyproject.toml +1 -1
  41. mkdocs_primer-0.1.2/mkdocs_primer/404.html +0 -11
  42. mkdocs_primer-0.1.2/mkdocs_primer/css/theme.css +0 -567
  43. mkdocs_primer-0.1.2/mkdocs_primer/partials/nav-item.html +0 -31
  44. mkdocs_primer-0.1.2/mkdocs_primer/partials/search-box.html +0 -9
  45. mkdocs_primer-0.1.2/mkdocs_primer/search.html +0 -27
  46. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/.gitignore +0 -0
  47. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/LICENSE +0 -0
  48. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/__init__.py +0 -0
  49. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/css/vendor/LICENSE +0 -0
  50. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/css/vendor/primer-core.css +0 -0
  51. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/css/vendor/primer-markdown.css +0 -0
  52. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/css/vendor/primitives-base.css +0 -0
  53. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/css/vendor/primitives-dark.css +0 -0
  54. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/css/vendor/primitives-light.css +0 -0
  55. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/img/favicon.svg +0 -0
  56. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/js/back-to-top.js +0 -0
  57. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/js/color-mode.js +0 -0
  58. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/main.html +0 -0
  59. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer/partials/nav.html +0 -0
  60. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer_mike/__init__.py +0 -0
  61. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer_mike/css/version-select.css +0 -0
  62. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/mkdocs_primer_mike/js/version-select.js +0 -0
  63. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/package.json +0 -0
  64. {mkdocs_primer-0.1.2 → mkdocs_primer-0.2.0}/scripts/vendor-css.mjs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mkdocs-primer
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: A MkDocs theme built on GitHub's Primer design system
5
5
  Project-URL: Homepage, https://github.com/olegshulyakov/mkdocs-primer
6
6
  Project-URL: Source, https://github.com/olegshulyakov/mkdocs-primer
@@ -47,7 +47,7 @@ theme:
47
47
  - Syntax highlighting mapped onto Primer's `prettylights` variables, so code colors follow the color mode. Works with both `pymdownx.highlight` and `codehilite`.
48
48
  - Copy buttons for Pygments code blocks and an accessible back-to-top control that respects reduced-motion preferences.
49
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.
50
+ - Sidebar navigation with unlimited nesting, collapsed down to the section the reader is in, plus a breadcrumb trail, prev/next links, a search results page, and a 404 page.
51
51
  - Optional Workbox-powered offline support for sites served over HTTPS.
52
52
  - "Improve this page" footer, as in the Jekyll theme, with a "Last updated" line when `mkdocs-git-revision-date-localized` is enabled.
53
53
  - 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/).
@@ -58,8 +58,10 @@ theme:
58
58
  | --- | --- | --- |
59
59
  | `logo` | `null` | Image shown beside the site name, relative to `docs_dir`. |
60
60
  | `favicon` | `img/favicon.svg` | Site icon. |
61
+ | `locale` | `en` | Language of the theme's own text. Catalogs ship for `en`, `es`, `fr`, `hi`, `pt`, `ru` and `zh`. |
61
62
  | `include_sidebar` | `true` | Render the navigation sidebar. |
62
63
  | `show_footer` | `true` | Render the "Improve this page" footer. |
64
+ | `toc` | `auto` | "On this page" outline: `auto`, `expanded`, `collapsed` or `hidden`. |
63
65
  | `color_mode` | `auto` | Initial color mode: `auto`, `light` or `dark`. |
64
66
  | `light_theme` | `light` | Primer theme used in light mode. |
65
67
  | `dark_theme` | `dark` | Primer theme used in dark mode. |
@@ -96,9 +98,15 @@ To preview the demo site:
96
98
 
97
99
  ```console
98
100
  $ pip install -e . -r requirements-docs.txt
99
- $ mkdocs serve
101
+ $ mkdocs serve --watch-theme
100
102
  ```
101
103
 
104
+ It is served at <http://127.0.0.1:8000/mkdocs-primer/> — `site_url` gives the site that path, and the dev server mounts it there.
105
+ `--watch-theme` is what makes the loop work while editing the theme: without it MkDocs watches `docs/` and `mkdocs.yml` only, and a change under `mkdocs_primer/` never reaches the browser.
106
+
107
+ VS Code users get this from `.vscode/`: **Run Task → Serve the demo site**, or `F5` for the same thing with a browser attached, at full width or under the theme's 1012px breakpoint.
108
+ `Build every site CI builds` runs the four strict builds below in order.
109
+
102
110
  ### Offline build
103
111
 
104
112
  The theme can register a service worker generated by [Workbox](https://developer.chrome.com/docs/workbox/). Enable `offline: true` under `theme`, build the site, then run `workbox generateSW` against the output directory. The included configuration is a complete example:
@@ -21,7 +21,7 @@ theme:
21
21
  - Syntax highlighting mapped onto Primer's `prettylights` variables, so code colors follow the color mode. Works with both `pymdownx.highlight` and `codehilite`.
22
22
  - Copy buttons for Pygments code blocks and an accessible back-to-top control that respects reduced-motion preferences.
23
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.
24
+ - Sidebar navigation with unlimited nesting, collapsed down to the section the reader is in, plus a breadcrumb trail, prev/next links, a search results page, and a 404 page.
25
25
  - Optional Workbox-powered offline support for sites served over HTTPS.
26
26
  - "Improve this page" footer, as in the Jekyll theme, with a "Last updated" line when `mkdocs-git-revision-date-localized` is enabled.
27
27
  - 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/).
@@ -32,8 +32,10 @@ theme:
32
32
  | --- | --- | --- |
33
33
  | `logo` | `null` | Image shown beside the site name, relative to `docs_dir`. |
34
34
  | `favicon` | `img/favicon.svg` | Site icon. |
35
+ | `locale` | `en` | Language of the theme's own text. Catalogs ship for `en`, `es`, `fr`, `hi`, `pt`, `ru` and `zh`. |
35
36
  | `include_sidebar` | `true` | Render the navigation sidebar. |
36
37
  | `show_footer` | `true` | Render the "Improve this page" footer. |
38
+ | `toc` | `auto` | "On this page" outline: `auto`, `expanded`, `collapsed` or `hidden`. |
37
39
  | `color_mode` | `auto` | Initial color mode: `auto`, `light` or `dark`. |
38
40
  | `light_theme` | `light` | Primer theme used in light mode. |
39
41
  | `dark_theme` | `dark` | Primer theme used in dark mode. |
@@ -70,9 +72,15 @@ To preview the demo site:
70
72
 
71
73
  ```console
72
74
  $ pip install -e . -r requirements-docs.txt
73
- $ mkdocs serve
75
+ $ mkdocs serve --watch-theme
74
76
  ```
75
77
 
78
+ It is served at <http://127.0.0.1:8000/mkdocs-primer/> — `site_url` gives the site that path, and the dev server mounts it there.
79
+ `--watch-theme` is what makes the loop work while editing the theme: without it MkDocs watches `docs/` and `mkdocs.yml` only, and a change under `mkdocs_primer/` never reaches the browser.
80
+
81
+ VS Code users get this from `.vscode/`: **Run Task → Serve the demo site**, or `F5` for the same thing with a browser attached, at full width or under the theme's 1012px breakpoint.
82
+ `Build every site CI builds` runs the four strict builds below in order.
83
+
76
84
  ### Offline build
77
85
 
78
86
  The theme can register a service worker generated by [Workbox](https://developer.chrome.com/docs/workbox/). Enable `offline: true` under `theme`, build the site, then run `workbox generateSW` against the output directory. The included configuration is a complete example:
@@ -0,0 +1,12 @@
1
+ {% extends "base.html" %}
2
+
3
+ {% block htmltitle %}404 - {{ config.site_name }}{% endblock %}
4
+
5
+ {% block content %}
6
+ <h1>404</h1>
7
+ <p>{% trans %}Sorry, this page could not be found.{% endtrans %}</p>
8
+ {# See partials/header.html: `nav` is not locale-safe in a static template. #}
9
+ <p><a href="{{ base_url }}">{% trans %}Back to the home page{% endtrans %}</a></p>
10
+ {% endblock %}
11
+
12
+ {% block pagination %}{% endblock %}
@@ -109,6 +109,12 @@
109
109
  #}
110
110
  <script>
111
111
  (function () {
112
+ // Marks the document as scriptable before anything is painted, so the
113
+ // stylesheet can collapse what js/nav-sections.js is about to take
114
+ // charge of. Without this the reader would watch the navigation fold
115
+ // itself up a moment after the page appeared.
116
+ document.documentElement.classList.add('primer-js')
117
+
112
118
  try {
113
119
  var mode = localStorage.getItem('mkdocs-primer-color-mode')
114
120
  if (mode) document.documentElement.setAttribute('data-color-mode', mode)
@@ -120,42 +126,76 @@
120
126
  </head>
121
127
 
122
128
  <body>
123
- <a href="#primer-content" class="sr-only primer-skip-link">Skip to content</a>
129
+ <a href="#primer-content" class="sr-only primer-skip-link">{% trans %}Skip to content{% endtrans %}</a>
124
130
 
125
131
  {%- block header %}
126
132
  {% include "partials/header.html" %}
127
133
  {%- endblock %}
128
134
 
129
- <div class="primer-layout container-xl px-3">
135
+ {#
136
+ Suppressed in a static template on a translated site: `nav` there is the
137
+ last locale mkdocs-static-i18n built, so every link would point out of the
138
+ locale the visitor is actually in. See partials/header.html.
139
+ #}
140
+ {%- set show_sidebar = config.theme.include_sidebar and nav and (page or not config.plugins.get('i18n')) %}
141
+ <div class="primer-layout{{ ' primer-layout-with-sidebar' if show_sidebar }}">
130
142
  {%- block site_nav %}
131
- {%- if config.theme.include_sidebar and nav %}
132
- <aside class="primer-sidebar" aria-label="Site navigation">
143
+ {%- if show_sidebar %}
144
+ <aside class="primer-sidebar" aria-label="{% trans %}Site navigation{% endtrans %}">
133
145
  {% include "partials/nav.html" %}
134
146
  </aside>
135
147
  {%- endif %}
136
148
  {%- endblock %}
137
149
 
138
- <main class="primer-main" id="primer-content">
139
- <article class="markdown-body">
140
- {%- block content %}
141
- {{ page.content }}
150
+ <div class="primer-content">
151
+ {#
152
+ Above the columns rather than beside them, so the trail starts where
153
+ the page title does and shares the reading column's width.
154
+ #}
155
+ {%- block breadcrumbs %}
156
+ {% include "partials/breadcrumbs.html" %}
157
+ {%- endblock %}
158
+
159
+ <div class="primer-columns">
160
+ {#
161
+ A sibling of the article, not a child of it: on a wide window the
162
+ stylesheet lifts it into the third column, and where there is no room
163
+ for one it stays here, above the prose. See partials/toc.html.
164
+ #}
165
+ {%- block toc %}
166
+ {% include "partials/toc.html" %}
142
167
  {%- endblock %}
143
- </article>
144
168
 
145
- {%- block pagination %}
146
- {% include "partials/pagination.html" %}
147
- {%- endblock %}
169
+ {#
170
+ tabindex="-1" is what makes the skip link work: without it the browser
171
+ scrolls but leaves focus at the top of the document, so the next Tab
172
+ goes straight back into the header the visitor just skipped.
173
+ #}
174
+ <main class="primer-main" id="primer-content" tabindex="-1">
175
+ <article class="markdown-body">
176
+ {%- block content %}
177
+ {{ page.content }}
178
+ {%- endblock %}
179
+ </article>
148
180
 
149
- {%- block footer %}
150
- {%- if config.theme.show_footer %}
151
- {% include "partials/footer.html" %}
152
- {%- endif %}
153
- {%- endblock %}
154
- </main>
181
+ {%- block pagination %}
182
+ {% include "partials/pagination.html" %}
183
+ {%- endblock %}
184
+
185
+ {%- block footer %}
186
+ {%- if config.theme.show_footer %}
187
+ {% include "partials/footer.html" %}
188
+ {%- endif %}
189
+ {%- endblock %}
190
+ </main>
191
+ </div>
192
+ </div>
155
193
  </div>
156
194
 
157
195
  <button class="btn btn-octicon primer-back-to-top" type="button"
158
- data-primer-back-to-top hidden aria-label="Back to top" title="Back to top">
196
+ data-primer-back-to-top hidden
197
+ aria-label="{% trans %}Back to top{% endtrans %}"
198
+ title="{% trans %}Back to top{% endtrans %}">
159
199
  {%- if config.theme.icon == 'lucide' %}
160
200
  <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>
161
201
  {%- else %}
@@ -173,12 +213,27 @@
173
213
  be enabled.
174
214
  #}
175
215
  <script>var base_url = {{ base_url | tojson }}</script>
216
+ {#
217
+ Strings for the controls the scripts build at runtime. A .js file is
218
+ served as-is and never passes through Jinja, so it cannot reach the
219
+ translation catalog itself.
220
+ #}
221
+ <script>
222
+ var primer_strings = {
223
+ copy: {{ gettext('Copy code') | tojson }},
224
+ copied: {{ gettext('Code copied') | tojson }},
225
+ copied_announcement: {{ gettext('Code copied to clipboard') | tojson }},
226
+ copy_failed: {{ gettext('Could not copy code to clipboard') | tojson }}
227
+ }
228
+ </script>
176
229
  <script src="{{ 'js/color-mode.js' | url }}" defer></script>
177
230
  <script src="{{ 'js/copy-code.js' | url }}" defer></script>
178
231
  <script src="{{ 'js/back-to-top.js' | url }}" defer></script>
179
- {%- if 'search' in config.plugins %}
180
- <script src="{{ 'search/main.js' | url }}" defer></script>
181
- {%- endif %}
232
+ <script src="{{ 'js/scrollable.js' | url }}" defer></script>
233
+ <script src="{{ 'js/nav-sections.js' | url }}" defer></script>
234
+ <script src="{{ 'js/toc-active.js' | url }}" defer></script>
235
+ {# Unconditional: the language and navigation popovers exist with or without search. #}
236
+ <script src="{{ 'js/disclosure.js' | url }}" defer></script>
182
237
  {%- if config.theme.offline %}
183
238
  <script>
184
239
  if ('serviceWorker' in navigator) {
@@ -105,6 +105,26 @@
105
105
  font-weight: var(--base-text-weight-semibold, 600);
106
106
  }
107
107
 
108
+ /*
109
+ * The one place this file departs from GitHub's palette. In dark mode
110
+ * --color-prettylights-syntax-markup-heading is #1f6feb, which against the
111
+ * code background is 3.74:1 — under the 4.5:1 WCAG AA needs at this size.
112
+ * --fgColor-accent is the same hue two steps lighter and reaches 5.7:1.
113
+ * A diff hunk header (`@@ -1,3 +1,3 @@`) is the common case, and it carries
114
+ * the line numbers, so it has to be readable.
115
+ */
116
+ [data-color-mode='dark'] :is(.highlight, .codehilite) :is(.gh, .gu) {
117
+ color: var(--fgColor-accent);
118
+ }
119
+
120
+ /* Same rule for `auto`, but only once the system has resolved to dark: in
121
+ light the vendored token is already 7.4:1 and stays GitHub-exact. */
122
+ @media (prefers-color-scheme: dark) {
123
+ [data-color-mode='auto'] :is(.highlight, .codehilite) :is(.gh, .gu) {
124
+ color: var(--fgColor-accent);
125
+ }
126
+ }
127
+
108
128
  :is(.highlight, .codehilite) .gt {
109
129
  color: var(--color-prettylights-syntax-meta-diff-range);
110
130
  }