mkdocs 2.0.dev0__py3-none-any.whl → 2.0.dev1__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/__version__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  __title__ = "mkdocs"
2
- __version__ = "2.0.dev0"
2
+ __version__ = "2.0.dev1"
mkdocs/mkdocs.py CHANGED
@@ -52,6 +52,12 @@ class Page:
52
52
  self.url = str(url).removesuffix('index.html')
53
53
 
54
54
 
55
+ class PageAsHTML:
56
+ def __init__(self, title, html):
57
+ self.title = title
58
+ self.html = html
59
+
60
+
55
61
  class Static:
56
62
  def __init__(self, path):
57
63
  self.path = path
@@ -125,7 +131,7 @@ class MkDocs:
125
131
  dir = pathlib.Path(input_dir)
126
132
  loader = jinja2.ChoiceLoader([
127
133
  jinja2.FileSystemLoader(dir.joinpath("templates")),
128
- jinja2.PackageLoader('mkdocs', 'default'),
134
+ jinja2.PackageLoader('mkdocs', 'theme'),
129
135
  ])
130
136
  env = jinja2.Environment(loader=loader, auto_reload=True)
131
137
  env.filters['url'] = url
@@ -134,7 +140,6 @@ class MkDocs:
134
140
  def init_md(self) -> markdown.Markdown:
135
141
  return markdown.Markdown(
136
142
  extensions=[
137
- 'codehilite',
138
143
  'fenced_code',
139
144
  'footnotes',
140
145
  'tables',
@@ -174,7 +179,8 @@ class MkDocs:
174
179
  with self.set_context(page):
175
180
  text = input_path.read_text()
176
181
  html = self.md.reset().convert(text)
177
- output = self.base.render(page=page, html=html)
182
+ title = self.md.toc_tokens[0]['name'] if self.md.toc_tokens else ''
183
+ output = self.base.render(page=PageAsHTML(title=title, html=html))
178
184
 
179
185
  output_path.parent.mkdir(parents=True, exist_ok=True)
180
186
  output_path.write_text(output)
@@ -205,7 +211,8 @@ class MkDocs:
205
211
  with self.set_context(resource):
206
212
  text = input_path.read_text()
207
213
  html = self.md.reset().convert(text)
208
- output = self.base.render(page=resource, html=html)
214
+ title = self.md.toc_tokens[0]['name'] if self.md.toc_tokens else ''
215
+ output = self.base.render(page=PageAsHTML(title=title, html=html))
209
216
  return httpx.Response(200, content=httpx.HTML(output))
210
217
  elif isinstance(resource, Static):
211
218
  input_path = input_dir.joinpath(resource.path)
mkdocs/theme/base.html ADDED
@@ -0,0 +1,173 @@
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
+ <title>{{ page.title }}</title>
6
+ <link rel="icon" href="data:image/svg+xml,&lt;svg xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 100 100&quot;&gt;&lt;text y=&quot;.9em&quot; font-size=&quot;90&quot;&gt;📘&lt;/text&gt;&lt;/svg&gt;">
7
+ <style>
8
+ /* Color scheme */
9
+
10
+ :root {
11
+ --fg-color: #f0f6fc;
12
+ --muted-fg-color: #9198a1;
13
+ --neutral-color: #3d444d;
14
+ --bg-color: #151b23;
15
+
16
+ --link-color: #4493f8;
17
+ --code-bg-color: #0d1117;
18
+
19
+ --accent-note: #0969da;
20
+ --accent-tip: #1a7f37;
21
+ --accent-important:#8250df;
22
+ --accent-warning: #9a6700;
23
+ --accent-caution: #d1242f;
24
+ }
25
+
26
+ /* Basic reset */
27
+
28
+ * {
29
+ margin: 0;
30
+ padding: 0;
31
+ box-sizing: border-box;
32
+ font-weight: 300;
33
+ }
34
+
35
+ /* Layout... */
36
+
37
+ main {
38
+ margin-left: 20%;
39
+ width: 60%;
40
+ padding: 1rem;
41
+ }
42
+
43
+ @media (max-width: 1000px) {
44
+ main {
45
+ padding: 1.5rem 1rem;
46
+ width: 75%;
47
+ margin-left: 25%;
48
+ }
49
+ }
50
+
51
+ @media (max-width: 800px) {
52
+ main {
53
+ padding: 1.5rem 1rem;
54
+ width: 100%;
55
+ margin-left: 0;
56
+ }
57
+ }
58
+
59
+ /* Typography & spacing */
60
+
61
+ html {
62
+ scroll-behavior: smooth;
63
+ }
64
+
65
+ body {
66
+ line-height: 1.6;
67
+ color: var(--fg-color);
68
+ background-color: var(--bg-color);
69
+ font-family: Helvetica, sans-serif;
70
+ }
71
+
72
+ h1, h2, h3, h4, h5 {
73
+ margin-top: 1.5rem;
74
+ margin-bottom: 1.5rem;
75
+ line-height: 1.3;
76
+ }
77
+
78
+ h1 {
79
+ border-bottom: 1px solid var(--neutral-color);
80
+ }
81
+ h2 {
82
+ border-bottom: 1px solid var(--neutral-color);
83
+ }
84
+
85
+ p {
86
+ margin: 1rem 0;
87
+ }
88
+
89
+ strong {
90
+ font-weight: 600;
91
+ }
92
+
93
+ ul, ol {
94
+ padding-left: 2rem;
95
+ }
96
+
97
+ li {
98
+ margin: 0.5rem 0;
99
+ }
100
+
101
+ hr {
102
+ margin-top: 1rem;
103
+ margin-bottom: 1rem;
104
+ border: none;
105
+ border-top: 4px solid;
106
+ color: var(--neutral-color);
107
+ }
108
+
109
+ blockquote {
110
+ border-left: 0.25rem solid var(--neutral-color);
111
+ padding: 0 1rem;
112
+ color: var(--muted-fg-color);
113
+ }
114
+
115
+ pre {
116
+ padding: 1rem;
117
+ overflow-x: scroll;
118
+ background-color: var(--code-bg-color);
119
+ }
120
+
121
+ code {
122
+ padding: 0 5px;
123
+ background-color: var(--code-bg-color);
124
+ }
125
+
126
+ pre code {
127
+ padding: 0;
128
+ }
129
+
130
+ img {
131
+ max-width: 100%
132
+ }
133
+
134
+ a {
135
+ color: var(--link-color);
136
+ text-decoration: none;
137
+ }
138
+
139
+ a:hover {
140
+ text-decoration: underline;
141
+ }
142
+
143
+ /* Tables */
144
+
145
+ table {
146
+ border-collapse: collapse;
147
+ }
148
+
149
+ th, td {
150
+ padding: 6px 13px;
151
+ border: 1px solid var(--neutral-color);
152
+ }
153
+
154
+ /* Header anchor links */
155
+
156
+ a.toclink {
157
+ color: inherit;
158
+ text-decoration: none;
159
+ }
160
+
161
+ a.toclink:hover::after {
162
+ content: "#";
163
+ margin: 0 0.8rem;
164
+ color: var(--neutral-color);
165
+ }
166
+ </style>
167
+ </head>
168
+ <body>
169
+ <main>
170
+ {{ page.html }}
171
+ </main>
172
+ </body>
173
+ </html>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mkdocs
3
- Version: 2.0.dev0
3
+ Version: 2.0.dev1
4
4
  Summary: HTTP, for Python.
5
5
  Author-email: Kim Christie <noreply@lovelydinosaur.com>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -18,4 +18,3 @@ Requires-Dist: click
18
18
  Requires-Dist: httpx>=1.0.dev5
19
19
  Requires-Dist: jinja2
20
20
  Requires-Dist: markdown
21
- Requires-Dist: pygments
@@ -1,6 +1,6 @@
1
1
  mkdocs/__init__.py,sha256=bpMsoVf4vXq24u68lQIJ4ZObI95LoIPRSOUq-NBw1_c,305
2
- mkdocs/__version__.py,sha256=V84ElieAtG9eXLkPpwbaQtU-de71QL4OnjUMft_zoaw,46
3
- mkdocs/mkdocs.py,sha256=xTAGPnLV72nXD9UEkp869uzAnoAOXxDyJgBxfnjNgKE,7791
2
+ mkdocs/__version__.py,sha256=7aOaBbMbjpNiX40Ox2Y0RiS7_5VKJ3vzhrYYxE1ETFA,46
3
+ mkdocs/mkdocs.py,sha256=u_Q3jPgMCsnIwpWUrlAqIbCeyiPVxwXALogeJXM2v5s,8074
4
4
  mkdocs/default/base.html,sha256=lrJDGMMkQq-iWkdjPwRDUWp-sBGZMMtqyvustu1dx9A,440
5
5
  mkdocs/default/favicon.html,sha256=6-o5g6-nIJRTp83ZzABUaaV0_JNcm-1HxdTKeLbLsxg,227
6
6
  mkdocs/default/highlight.css,sha256=2N7xpE1RkMFjJSnFOjQX3x0Mj6yKf6pM8-B08rE2n-o,5600
@@ -9,7 +9,8 @@ mkdocs/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
9
9
  mkdocs/extensions/relative_urls.py,sha256=LbcM00LtwlMjAoflVuPklbe_KJyDroOcNVO1SuksnvE,1968
10
10
  mkdocs/extensions/short_codes.py,sha256=I2SwGMcG9OT_vpkJwPI8cHBTkwQAjSPZmoQKfctsHn4,950
11
11
  mkdocs/extensions/strike_thru.py,sha256=GrCbfMrHz_2Vlh3E572EQYOSDzEGym34pkHElzF2HZY,577
12
- mkdocs-2.0.dev0.dist-info/METADATA,sha256=bX1SxU0W7wFwV374EwtAXy31_eQT_yiL6Atlxoe0kCI,753
13
- mkdocs-2.0.dev0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
14
- mkdocs-2.0.dev0.dist-info/entry_points.txt,sha256=5PqBrzYJLZ9-yQ0djvENWOQ-0x6Xj30JYNSzM_m70ZU,38
15
- mkdocs-2.0.dev0.dist-info/RECORD,,
12
+ mkdocs/theme/base.html,sha256=IMq7rrAb97Hg3lKAxPtCufuwe3zNfRlWBGjvvT6kzSc,2785
13
+ mkdocs-2.0.dev1.dist-info/METADATA,sha256=MQSfNOVSNEgd7aXeLla7ewl7HUB_CFwsAkjH9s4HChM,729
14
+ mkdocs-2.0.dev1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
15
+ mkdocs-2.0.dev1.dist-info/entry_points.txt,sha256=5PqBrzYJLZ9-yQ0djvENWOQ-0x6Xj30JYNSzM_m70ZU,38
16
+ mkdocs-2.0.dev1.dist-info/RECORD,,