mkdocs-markgraf 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mark Eibes
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,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: mkdocs-markgraf
3
+ Version: 0.1.0
4
+ Summary: MkDocs plugin that renders markgraf animations using the Canvas2D embed bundle.
5
+ Author-email: Mark Eibes <mark.eibes@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Mark Eibes
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/markgrafhq/mkdocs-markgraf
29
+ Project-URL: Source, https://github.com/markgrafhq/mkdocs-markgraf
30
+ Project-URL: Issues, https://github.com/markgrafhq/mkdocs-markgraf/issues
31
+ Keywords: mkdocs,mkdocs-plugin,markgraf,animation,diagram,documentation
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.9
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Topic :: Documentation
43
+ Classifier: Topic :: Software Development :: Documentation
44
+ Classifier: Topic :: Text Processing :: Markup
45
+ Requires-Python: >=3.9
46
+ Description-Content-Type: text/markdown
47
+ License-File: LICENSE
48
+ Requires-Dist: mkdocs>=1.5
49
+ Dynamic: license-file
50
+
51
+ # mkdocs-markgraf
52
+
53
+ MkDocs plugin that renders [markgraf](https://github.com/i-am-the-slime/markgraf)
54
+ animations inside documentation pages.
55
+
56
+ Fenced ` ```markgraf ` blocks become an interactive Canvas2D player with a
57
+ scrub bar, keyframe ticks, play/pause, and speed control. The bundled JS/CSS
58
+ ships with the plugin — no CDN, no external dependencies at runtime.
59
+
60
+ ## Install
61
+
62
+ ```bash
63
+ pip install mkdocs-markgraf
64
+ ```
65
+
66
+ ## Use
67
+
68
+ `mkdocs.yml`:
69
+
70
+ ```yaml
71
+ plugins:
72
+ - markgraf
73
+ ```
74
+
75
+ Inside a page:
76
+
77
+ ````markdown
78
+ ```markgraf
79
+ seed 1
80
+
81
+ frame v1 {
82
+ +node client "Client"
83
+ +node api "API"
84
+ +node db "Database"
85
+ +edge client api
86
+ +edge api db
87
+ client -> api "GET /user/42"
88
+ api -> db "SELECT"
89
+ }
90
+
91
+ frame v2 {
92
+ +node cache "Cache"
93
+ -edge api db
94
+ +edge api cache
95
+ client -> api "GET /user/42"
96
+ api -> cache "HIT"
97
+ }
98
+ ```
99
+ ````
100
+
101
+ ## Sizing
102
+
103
+ Constrain the embed via fence attributes:
104
+
105
+ ````markdown
106
+ ```markgraf height=320
107
+
108
+ ```
109
+
110
+ ```markgraf width=420
111
+
112
+ ```
113
+
114
+ ```markgraf height=80svh
115
+
116
+ ```
117
+ ````
118
+
119
+ Values default to `px`; `svh`, `vh`, `dvh`, `%`, `em`, `rem` are accepted as
120
+ explicit units. `height` clamps `max-height` on the canvas; `width` clamps
121
+ `max-width` on the embed container.
122
+
123
+ ## Player controls
124
+
125
+ - Click the canvas or press **Space** anywhere to toggle play/pause.
126
+ - Click ticks on the scrub bar to jump between keyframes.
127
+ - Only one embed plays at a time — starting one pauses the others.
128
+ - The control bar is overlaid on the canvas and only shown on hover or focus.
129
+
130
+ ## Configuration
131
+
132
+ `mkdocs.yml`:
133
+
134
+ ```yaml
135
+ plugins:
136
+ - markgraf:
137
+ assets_subdir: assets/markgraf # where to copy the bundled JS/CSS
138
+ js_path: /path/to/markgraf-embed.js # override the bundled JS
139
+ css_path: /path/to/markgraf-embed.css # override the bundled CSS
140
+ ```
141
+
142
+ ## License
143
+
144
+ MIT.
@@ -0,0 +1,94 @@
1
+ # mkdocs-markgraf
2
+
3
+ MkDocs plugin that renders [markgraf](https://github.com/i-am-the-slime/markgraf)
4
+ animations inside documentation pages.
5
+
6
+ Fenced ` ```markgraf ` blocks become an interactive Canvas2D player with a
7
+ scrub bar, keyframe ticks, play/pause, and speed control. The bundled JS/CSS
8
+ ships with the plugin — no CDN, no external dependencies at runtime.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pip install mkdocs-markgraf
14
+ ```
15
+
16
+ ## Use
17
+
18
+ `mkdocs.yml`:
19
+
20
+ ```yaml
21
+ plugins:
22
+ - markgraf
23
+ ```
24
+
25
+ Inside a page:
26
+
27
+ ````markdown
28
+ ```markgraf
29
+ seed 1
30
+
31
+ frame v1 {
32
+ +node client "Client"
33
+ +node api "API"
34
+ +node db "Database"
35
+ +edge client api
36
+ +edge api db
37
+ client -> api "GET /user/42"
38
+ api -> db "SELECT"
39
+ }
40
+
41
+ frame v2 {
42
+ +node cache "Cache"
43
+ -edge api db
44
+ +edge api cache
45
+ client -> api "GET /user/42"
46
+ api -> cache "HIT"
47
+ }
48
+ ```
49
+ ````
50
+
51
+ ## Sizing
52
+
53
+ Constrain the embed via fence attributes:
54
+
55
+ ````markdown
56
+ ```markgraf height=320
57
+
58
+ ```
59
+
60
+ ```markgraf width=420
61
+
62
+ ```
63
+
64
+ ```markgraf height=80svh
65
+
66
+ ```
67
+ ````
68
+
69
+ Values default to `px`; `svh`, `vh`, `dvh`, `%`, `em`, `rem` are accepted as
70
+ explicit units. `height` clamps `max-height` on the canvas; `width` clamps
71
+ `max-width` on the embed container.
72
+
73
+ ## Player controls
74
+
75
+ - Click the canvas or press **Space** anywhere to toggle play/pause.
76
+ - Click ticks on the scrub bar to jump between keyframes.
77
+ - Only one embed plays at a time — starting one pauses the others.
78
+ - The control bar is overlaid on the canvas and only shown on hover or focus.
79
+
80
+ ## Configuration
81
+
82
+ `mkdocs.yml`:
83
+
84
+ ```yaml
85
+ plugins:
86
+ - markgraf:
87
+ assets_subdir: assets/markgraf # where to copy the bundled JS/CSS
88
+ js_path: /path/to/markgraf-embed.js # override the bundled JS
89
+ css_path: /path/to/markgraf-embed.css # override the bundled CSS
90
+ ```
91
+
92
+ ## License
93
+
94
+ MIT.
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mkdocs-markgraf"
7
+ version = "0.1.0"
8
+ description = "MkDocs plugin that renders markgraf animations using the Canvas2D embed bundle."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "Mark Eibes", email = "mark.eibes@gmail.com" }]
13
+ keywords = ["mkdocs", "mkdocs-plugin", "markgraf", "animation", "diagram", "documentation"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Documentation",
26
+ "Topic :: Software Development :: Documentation",
27
+ "Topic :: Text Processing :: Markup",
28
+ ]
29
+ dependencies = ["mkdocs>=1.5"]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/markgrafhq/mkdocs-markgraf"
33
+ Source = "https://github.com/markgrafhq/mkdocs-markgraf"
34
+ Issues = "https://github.com/markgrafhq/mkdocs-markgraf/issues"
35
+
36
+ [project.entry-points."mkdocs.plugins"]
37
+ markgraf = "mkdocs_markgraf.plugin:MarkgrafPlugin"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
41
+
42
+ [tool.setuptools.package-data]
43
+ mkdocs_markgraf = ["assets/*.js", "assets/*.css"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,281 @@
1
+ .markgraf-embed {
2
+ --mg-bg: #ffffff;
3
+ --mg-fg: #111111;
4
+ --mg-bar-bg: #111111;
5
+ --mg-bar-fg: #ffffff;
6
+ --mg-muted: #9a9a9a;
7
+ --mg-accent: #ffffff;
8
+ --mg-track: #111111;
9
+ --mg-track-hover: #111111;
10
+ position: relative;
11
+ border-radius: 10px;
12
+ background: transparent;
13
+ color: var(--mg-fg);
14
+ font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
15
+ overflow: hidden;
16
+ }
17
+
18
+ .markgraf-embed canvas[data-mg="stage"] {
19
+ width: 100%;
20
+ display: block;
21
+ max-height: var(--mg-max-height, 90svh);
22
+ object-fit: contain;
23
+ }
24
+
25
+ .markgraf-embed :focus,
26
+ .markgraf-embed :focus-visible {
27
+ outline: none;
28
+ }
29
+
30
+ /* Big centered play hint shown while paused. Hidden as soon as a play
31
+ button anywhere in the embed flips to data-mg-playing="1". */
32
+ .markgraf-embed [data-mg="play-overlay"] {
33
+ position: absolute;
34
+ inset: 0;
35
+ margin: auto;
36
+ width: 72px;
37
+ height: 72px;
38
+ border-radius: 50%;
39
+ background: rgba(0, 0, 0, 0.55);
40
+ pointer-events: none;
41
+ opacity: 0;
42
+ transform: scale(0.85);
43
+ transition: opacity 0.12s ease, transform 0.12s ease;
44
+ }
45
+
46
+ .markgraf-embed [data-mg="play-overlay"]::before {
47
+ content: "";
48
+ position: absolute;
49
+ inset: 0;
50
+ margin: auto;
51
+ width: 32px;
52
+ height: 32px;
53
+ background: #fff;
54
+ -webkit-mask: var(--mg-icon-play) center / contain no-repeat;
55
+ mask: var(--mg-icon-play) center / contain no-repeat;
56
+ }
57
+
58
+ .markgraf-embed:has([data-mg="play"][data-mg-playing="0"]) [data-mg="play-overlay"] {
59
+ opacity: 1;
60
+ transform: scale(1);
61
+ }
62
+
63
+ .markgraf-embed [data-mg="bar"] {
64
+ position: absolute;
65
+ left: 0;
66
+ right: 0;
67
+ bottom: 0;
68
+ display: flex;
69
+ align-items: center;
70
+ gap: 8px;
71
+ padding: 6px 8px;
72
+ background: rgba(255, 255, 255, 0.92);
73
+ color: var(--mg-fg);
74
+ opacity: 0;
75
+ transform: translateY(2px);
76
+ transition: opacity 0.08s ease, transform 0.08s ease;
77
+ pointer-events: none;
78
+ }
79
+
80
+ .markgraf-embed:hover [data-mg="bar"],
81
+ .markgraf-embed:focus-within [data-mg="bar"] {
82
+ opacity: 1;
83
+ transform: translateY(0);
84
+ pointer-events: auto;
85
+ transition: opacity 0.16s ease, transform 0.16s ease;
86
+ }
87
+
88
+ .markgraf-embed [data-mg="play"] {
89
+ background: transparent;
90
+ color: var(--mg-fg);
91
+ border: 0;
92
+ border-radius: 999px;
93
+ width: 22px;
94
+ height: 22px;
95
+ padding: 0;
96
+ cursor: pointer;
97
+ display: inline-flex;
98
+ align-items: center;
99
+ justify-content: center;
100
+ transition: background 0.1s ease;
101
+ }
102
+
103
+ .markgraf-embed [data-mg="play"]:hover {
104
+ background: rgba(0, 0, 0, 0.08);
105
+ }
106
+
107
+ /* Heroicons v2 solid play / pause, rendered as a mask so the icon picks up
108
+ currentColor (light-mode black, dark-mode white via the bar override). */
109
+ .markgraf-embed [data-mg="play"]::before {
110
+ content: "";
111
+ display: block;
112
+ width: 14px;
113
+ height: 14px;
114
+ background: currentColor;
115
+ -webkit-mask: var(--mg-icon-play) center / contain no-repeat;
116
+ mask: var(--mg-icon-play) center / contain no-repeat;
117
+ }
118
+
119
+ .markgraf-embed [data-mg="play"][data-mg-playing="1"]::before {
120
+ -webkit-mask: var(--mg-icon-pause) center / contain no-repeat;
121
+ mask: var(--mg-icon-pause) center / contain no-repeat;
122
+ }
123
+
124
+ .markgraf-embed {
125
+ --mg-icon-play: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653Z'/></svg>");
126
+ --mg-icon-pause: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M6.75 5.25a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H7.5a.75.75 0 0 1-.75-.75V5.25Zm7.5 0A.75.75 0 0 1 15 4.5h1.5a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H15a.75.75 0 0 1-.75-.75V5.25Z'/></svg>");
127
+ }
128
+
129
+ .markgraf-embed [data-mg="time"] {
130
+ font-variant-numeric: tabular-nums;
131
+ font-size: 11px;
132
+ color: var(--mg-fg);
133
+ white-space: nowrap;
134
+ }
135
+
136
+ .markgraf-embed [data-mg="speed"] {
137
+ background: transparent;
138
+ border: 1px solid currentColor;
139
+ border-radius: 4px;
140
+ padding: 1px 4px;
141
+ color: var(--mg-fg);
142
+ font: 11px/1 inherit;
143
+ cursor: pointer;
144
+ }
145
+
146
+ .markgraf-embed [data-mg="speed"] option {
147
+ color: var(--mg-fg);
148
+ background: var(--mg-bg);
149
+ }
150
+
151
+ .markgraf-embed [data-mg="scrub-wrap"] {
152
+ position: relative;
153
+ flex: 1;
154
+ display: flex;
155
+ align-items: center;
156
+ }
157
+
158
+ .markgraf-embed [data-mg="ticks"] {
159
+ position: absolute;
160
+ left: 7px;
161
+ right: 7px;
162
+ top: 50%;
163
+ transform: translateY(-50%);
164
+ height: 18px;
165
+ pointer-events: none;
166
+ }
167
+
168
+ .markgraf-embed .mg-tick {
169
+ position: absolute;
170
+ top: 50%;
171
+ width: 4px;
172
+ height: 4px;
173
+ margin-left: -2px;
174
+ margin-top: -2px;
175
+ border-radius: 50%;
176
+ background: #fff;
177
+ opacity: 0.7;
178
+ pointer-events: auto;
179
+ cursor: pointer;
180
+ transition: transform 0.1s ease, opacity 0.1s ease;
181
+ }
182
+
183
+ .markgraf-embed .mg-tick:hover {
184
+ opacity: 1;
185
+ transform: scale(1.6);
186
+ }
187
+
188
+ .markgraf-embed .mg-tick::after {
189
+ content: attr(data-label);
190
+ position: absolute;
191
+ bottom: 100%;
192
+ left: 50%;
193
+ transform: translate(-50%, -4px);
194
+ background: rgba(15, 23, 42, 0.95);
195
+ color: #fff;
196
+ font-size: 11px;
197
+ padding: 2px 6px;
198
+ border-radius: 4px;
199
+ white-space: nowrap;
200
+ opacity: 0;
201
+ pointer-events: none;
202
+ transition: opacity 0.1s ease;
203
+ }
204
+
205
+ .markgraf-embed .mg-tick:hover::after {
206
+ opacity: 1;
207
+ }
208
+
209
+ /* Custom-styled scrubber. Cross-browser range inputs are notoriously ugly,
210
+ so we strip the native chrome and rebuild from CSS primitives. */
211
+ .markgraf-embed [data-mg="scrub"] {
212
+ -webkit-appearance: none;
213
+ appearance: none;
214
+ width: 100%;
215
+ height: 18px;
216
+ background: transparent;
217
+ cursor: pointer;
218
+ margin: 0;
219
+ position: relative;
220
+ z-index: 1;
221
+ }
222
+
223
+ .markgraf-embed [data-mg="scrub"]::-webkit-slider-runnable-track {
224
+ height: 4px;
225
+ background: var(--mg-track);
226
+ border-radius: 999px;
227
+ transition: background 0.15s ease;
228
+ }
229
+
230
+ .markgraf-embed [data-mg="scrub"]:hover::-webkit-slider-runnable-track {
231
+ background: var(--mg-track-hover);
232
+ }
233
+
234
+ .markgraf-embed [data-mg="scrub"]::-moz-range-track {
235
+ height: 4px;
236
+ background: var(--mg-track);
237
+ border-radius: 999px;
238
+ }
239
+
240
+ .markgraf-embed [data-mg="scrub"]::-webkit-slider-thumb {
241
+ -webkit-appearance: none;
242
+ appearance: none;
243
+ width: 14px;
244
+ height: 14px;
245
+ border-radius: 50%;
246
+ background: #111;
247
+ border: 2px solid #fff;
248
+ margin-top: -5px;
249
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
250
+ transition: transform 0.08s ease;
251
+ }
252
+
253
+ .markgraf-embed [data-mg="scrub"]:hover::-webkit-slider-thumb {
254
+ transform: scale(1.15);
255
+ }
256
+
257
+ .markgraf-embed [data-mg="scrub"]::-moz-range-thumb {
258
+ width: 14px;
259
+ height: 14px;
260
+ border-radius: 50%;
261
+ background: #111;
262
+ border: 2px solid #fff;
263
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
264
+ }
265
+
266
+ @media (prefers-color-scheme: dark) {
267
+ .markgraf-embed {
268
+ --mg-bg: #111111;
269
+ --mg-fg: #ffffff;
270
+ --mg-track: #ffffff;
271
+ --mg-track-hover: #ffffff;
272
+ }
273
+ .markgraf-embed [data-mg="bar"] {
274
+ background: rgba(17, 17, 17, 0.92);
275
+ }
276
+ .markgraf-embed [data-mg="scrub"]::-webkit-slider-thumb,
277
+ .markgraf-embed [data-mg="scrub"]::-moz-range-thumb {
278
+ background: #fff;
279
+ border-color: #111;
280
+ }
281
+ }