mkdocs-primer 0.1.0__py3-none-any.whl
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.
- mkdocs_primer/404.html +11 -0
- mkdocs_primer/__init__.py +20 -0
- mkdocs_primer/base.html +168 -0
- mkdocs_primer/css/pygments.css +121 -0
- mkdocs_primer/css/theme.css +544 -0
- mkdocs_primer/css/vendor/LICENSE +21 -0
- mkdocs_primer/css/vendor/primer-core.css +12 -0
- mkdocs_primer/css/vendor/primer-markdown.css +7 -0
- mkdocs_primer/css/vendor/primitives-base.css +304 -0
- mkdocs_primer/css/vendor/primitives-dark.css +1934 -0
- mkdocs_primer/css/vendor/primitives-light.css +1934 -0
- mkdocs_primer/img/favicon.svg +3 -0
- mkdocs_primer/js/back-to-top.js +23 -0
- mkdocs_primer/js/color-mode.js +50 -0
- mkdocs_primer/js/copy-code.js +59 -0
- mkdocs_primer/main.html +1 -0
- mkdocs_primer/mkdocs_theme.yml +42 -0
- mkdocs_primer/partials/color-mode.html +21 -0
- mkdocs_primer/partials/footer.html +31 -0
- mkdocs_primer/partials/header.html +37 -0
- mkdocs_primer/partials/language.html +49 -0
- mkdocs_primer/partials/nav-item.html +31 -0
- mkdocs_primer/partials/nav.html +5 -0
- mkdocs_primer/partials/pagination.html +16 -0
- mkdocs_primer/partials/search-box.html +9 -0
- mkdocs_primer/search.html +27 -0
- mkdocs_primer-0.1.0.dist-info/METADATA +115 -0
- mkdocs_primer-0.1.0.dist-info/RECORD +34 -0
- mkdocs_primer-0.1.0.dist-info/WHEEL +4 -0
- mkdocs_primer-0.1.0.dist-info/entry_points.txt +5 -0
- mkdocs_primer-0.1.0.dist-info/licenses/LICENSE +21 -0
- mkdocs_primer_mike/__init__.py +16 -0
- mkdocs_primer_mike/css/version-select.css +19 -0
- mkdocs_primer_mike/js/version-select.js +98 -0
mkdocs_primer/404.html
ADDED
|
@@ -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
|
+
"""
|
mkdocs_primer/base.html
ADDED
|
@@ -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
|
+
}
|