markwright 0.2.0__tar.gz → 0.4.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 (75) hide show
  1. markwright-0.4.0/.gitignore +25 -0
  2. markwright-0.4.0/CHANGELOG.md +152 -0
  3. {markwright-0.2.0 → markwright-0.4.0}/NOTICE +11 -6
  4. {markwright-0.2.0 → markwright-0.4.0}/PKG-INFO +66 -35
  5. {markwright-0.2.0 → markwright-0.4.0}/README.md +55 -24
  6. markwright-0.2.0/pyproject.toml.orig → markwright-0.4.0/pyproject.toml +15 -10
  7. markwright-0.4.0/src/markwright/__init__.py +25 -0
  8. markwright-0.4.0/src/markwright/_containers.py +430 -0
  9. markwright-0.4.0/src/markwright/_diagnostics.py +20 -0
  10. markwright-0.4.0/src/markwright/_embed_load.py +82 -0
  11. markwright-0.4.0/src/markwright/_fences.py +550 -0
  12. markwright-0.4.0/src/markwright/_html.py +272 -0
  13. markwright-0.4.0/src/markwright/_markers.py +235 -0
  14. markwright-0.4.0/src/markwright/annotate.py +272 -0
  15. markwright-0.4.0/src/markwright/button.py +88 -0
  16. markwright-0.4.0/src/markwright/cli.py +350 -0
  17. markwright-0.4.0/src/markwright/codepen.py +269 -0
  18. markwright-0.4.0/src/markwright/config.py +321 -0
  19. markwright-0.4.0/src/markwright/fence.py +532 -0
  20. markwright-0.4.0/src/markwright/grid.py +438 -0
  21. markwright-0.4.0/src/markwright/highlight.py +286 -0
  22. markwright-0.4.0/src/markwright/icons.py +220 -0
  23. {markwright-0.2.0 → markwright-0.4.0}/src/markwright/image_compare.py +27 -35
  24. markwright-0.4.0/src/markwright/instagram.py +252 -0
  25. markwright-0.4.0/src/markwright/lightbox.py +87 -0
  26. markwright-0.4.0/src/markwright/mermaid.py +182 -0
  27. markwright-0.4.0/src/markwright/registry.py +199 -0
  28. {markwright-0.2.0 → markwright-0.4.0}/src/markwright/slideshow.py +33 -40
  29. markwright-0.4.0/src/markwright/tabs.py +357 -0
  30. markwright-0.4.0/src/markwright/twitter.py +245 -0
  31. {markwright-0.2.0 → markwright-0.4.0}/src/markwright/youtube.py +60 -24
  32. markwright-0.4.0/tests/integration/test_clean_install.py +117 -0
  33. markwright-0.4.0/tests/integration/test_hugo_pipeline.py +510 -0
  34. markwright-0.4.0/tests/test_annotate.py +313 -0
  35. markwright-0.4.0/tests/test_button.py +97 -0
  36. markwright-0.4.0/tests/test_cli.py +861 -0
  37. markwright-0.4.0/tests/test_codepen.py +187 -0
  38. markwright-0.4.0/tests/test_config.py +507 -0
  39. markwright-0.4.0/tests/test_container_priority.py +61 -0
  40. markwright-0.4.0/tests/test_containers.py +445 -0
  41. markwright-0.4.0/tests/test_docs_tokens.py +37 -0
  42. markwright-0.4.0/tests/test_fence.py +672 -0
  43. markwright-0.4.0/tests/test_fences_map_lines.py +267 -0
  44. markwright-0.4.0/tests/test_fences_map_prose.py +187 -0
  45. markwright-0.4.0/tests/test_grid.py +644 -0
  46. markwright-0.4.0/tests/test_highlight.py +493 -0
  47. markwright-0.4.0/tests/test_html.py +24 -0
  48. markwright-0.4.0/tests/test_icons.py +350 -0
  49. markwright-0.4.0/tests/test_image_compare.py +168 -0
  50. markwright-0.4.0/tests/test_instagram.py +222 -0
  51. markwright-0.4.0/tests/test_lightbox.py +67 -0
  52. markwright-0.4.0/tests/test_load.py +205 -0
  53. markwright-0.4.0/tests/test_markers.py +101 -0
  54. markwright-0.4.0/tests/test_mermaid.py +255 -0
  55. markwright-0.4.0/tests/test_packaging.py +53 -0
  56. markwright-0.4.0/tests/test_registry.py +91 -0
  57. markwright-0.4.0/tests/test_roundtrip.py +920 -0
  58. markwright-0.4.0/tests/test_slideshow.py +210 -0
  59. markwright-0.4.0/tests/test_tabs.py +412 -0
  60. markwright-0.4.0/tests/test_twitter.py +204 -0
  61. markwright-0.4.0/tests/test_youtube.py +156 -0
  62. markwright-0.2.0/pyproject.toml +0 -81
  63. markwright-0.2.0/src/markwright/__init__.py +0 -0
  64. markwright-0.2.0/src/markwright/_util.py +0 -31
  65. markwright-0.2.0/src/markwright/cli.py +0 -245
  66. markwright-0.2.0/src/markwright/codepen.py +0 -208
  67. markwright-0.2.0/src/markwright/config.py +0 -220
  68. markwright-0.2.0/src/markwright/fence.py +0 -500
  69. markwright-0.2.0/src/markwright/highlight.py +0 -191
  70. markwright-0.2.0/src/markwright/instagram.py +0 -195
  71. markwright-0.2.0/src/markwright/registry.py +0 -135
  72. markwright-0.2.0/src/markwright/twitter.py +0 -189
  73. {markwright-0.2.0 → markwright-0.4.0}/LICENSE +0 -0
  74. {markwright-0.2.0 → markwright-0.4.0}/LICENSE-Apache-2.0 +0 -0
  75. {markwright-0.2.0 → markwright-0.4.0}/src/markwright/py.typed +0 -0
@@ -0,0 +1,25 @@
1
+ commit-msg.md
2
+ goal.md
3
+ .ai-sessions/implementation-notes.md
4
+
5
+ # Python-generated files
6
+ __pycache__/
7
+ *.py[oc]
8
+ build/
9
+ dist/
10
+ wheels/
11
+ *.egg-info
12
+
13
+ # Virtual environments
14
+ .venv
15
+
16
+ # MkDocs build output
17
+ site/
18
+
19
+ # Coverage artifacts
20
+ .coverage
21
+ *.cover
22
+ htmlcov/
23
+
24
+ # Hypothesis example database
25
+ .hypothesis/
@@ -0,0 +1,152 @@
1
+ # Changelog
2
+
3
+ All notable changes to markwright are recorded here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [0.4.0] - 2026-11-22
7
+
8
+ Six new extensions that cover the Material for MkDocs authoring features (#16), a `tabs` extension plus block grids and cards on the `grid` extension (#30), and the docs-site pieces that demonstrate them.
9
+ A document that uses none of the new directives or shortcodes renders as it did, apart from the changes listed under Upgrading from 0.3.0 and Fixed.
10
+
11
+ ### Upgrading from 0.3.0
12
+
13
+ - The new extensions are on by default in `mw`, so `mw list` and `mw config` show 15 extensions instead of 8.
14
+ A document that happens to contain a standalone `[button ...]`, `[lightbox ...]`, `[grid]`, `[grid cards]`, `[grid N]`, `[grid cards N]`, `[card]`, `[tab NAME]`, `[/grid]`, `[/card]`, `[/tab]`, or `[annotate]` line, or a `mermaid` fence, now renders differently; use `disable` or `--exclude` to turn one off.
15
+ - `selected_extensions` with no `enable` list now returns fifteen names where 0.3.0 returned eight, so a host tool that passes its result to Python-Markdown loads the seven new extensions unless it sets `disable` or `enable`.
16
+ - A `[grid]` or `[annotate]` line with no list or block after it is removed from the output; it used to stay as text.
17
+ - An existing `warn = true` in a config file now makes `mw post` print its diagnostics, since `mw post` reads that key as the default for `--warn` (#33).
18
+ - A highlight pair no longer spans a line break: a `<^>` marker pairs with the next marker on the same line, in the in-process render and in `mw pre` alike, so a pair that crossed a line end stops highlighting and an opener with no closer on its line stays literal (#34).
19
+ - A directive line indented under a list item, or in the body of an admonition, details block, content tab, definition, or footnote, now expands at its own indentation, so the expansion stays inside the item or body (an embed under a list item no longer ends the list in-process).
20
+ A directive at column 0 renders as before.
21
+ - `config_from_mapping` is stricter: a table that is not a mapping is a `ConfigError`, and an unknown key is an error whatever its value, `None` included.
22
+ - `fence.label_class` and `fence.secondary_label_class` must be space-separated class tokens of letters, digits, `-`, and `_`; an empty value or one with other characters is a config error.
23
+ - The `markdown` floor is `>=3.8.2`, up from `>=3.4`: 3.8.2 is the first Python-Markdown release that passes the suite, so an environment pinned below it has to upgrade.
24
+ - `icons` does nothing until you configure `packs`, so `:name:` text is untouched by default.
25
+ - If your `mkdocs.yml` has a `pymdownx.superfences` `custom_fences` entry named `mermaid` and you load `markwright.mermaid`, the entry goes inert because markwright replaces the fence first; remove it.
26
+
27
+ ### Added
28
+
29
+ - `markwright.button`: `[button URL TEXT]` and `[button primary URL TEXT]` become `<a class="mw-button">` links.
30
+ - `markwright.lightbox`: `[lightbox URL ALT]` becomes an `<a class="mw-lightbox">` wrapping an `<img>`.
31
+ - `markwright.mermaid`: a `mermaid` fence becomes `<pre class="mermaid">` for a host script to draw.
32
+ - `markwright.icons`: `:pack-name:` shortcodes become inline SVG wrapped in `<span class="mw-icon">`, read from directories named by the new `packs` option.
33
+ markwright ships no icons.
34
+ - `markwright.grid`: `[grid]` and `[grid cards]` add `mw-grid` and `mw-grid-cards` classes to the next list; a paired `[grid]` ... `[/grid]` wraps any Markdown blocks as grid cells, `[card]` ... `[/card]` wraps one card inside a block grid, and `[grid N]` sets a 1-to-6 column count as `mw-grid-cols-N`.
35
+ Carried through versioned `mw-grid`, `mw-grid-block`, `mw-grid-end`, `mw-card`, and `mw-card-end` marker comments, with an `mw-grid-problem` marker for a container left literal (#30).
36
+ - `markwright.annotate`: `[annotate]` links `(N)` markers in a block to the items of the ordered list after it, through a versioned `mw-annotate` marker comment.
37
+ - `markwright.tabs`: consecutive `[tab NAME]` ... `[/tab]` blocks become one `tabbed` set with the `mw-tabs` class, `mw-tab-S-T` ids, and `mw-tab-S` radio names, through versioned `mw-tab` and `mw-tab-end` marker comments, with an `mw-tab-problem` marker for a tab left literal (#30).
38
+ - `disallowed_environments(source, config)`, a public function that lists the fence environments a document names outside `fence.allowed_environments` (#32).
39
+ - A shared marker module for the fence, grid, annotate, and tabs marker comments, and a container-pairing scanner shared by grid and tabs (#30).
40
+ - Docs pages for the six material extensions and `tabs`, each with the `mw-` HTML contract and a live demo, and a Host CSS and Script section on every extension page (#30).
41
+ - A Material Mapping docs page that maps each Material for MkDocs reference feature to its in-process and Hugo providers, with the gaps.
42
+ - Demo-site host assets that show how a host styles the output: CSS in `extra.css` (including grid columns, cards, and CSS-only tabs), scripts for mermaid, the lightbox, and annotation tooltips, and two small icon packs under `docs/icons/` with credits in `CREDITS.txt`.
43
+ These are not part of the package.
44
+ - The docs `mw list` and `mw config` samples, `config.md`, and the MkDocs integration guide now cover the six extensions, `tabs`, and the `icons` `packs` option.
45
+
46
+ ### Changed
47
+
48
+ - The docs site no longer carries a `custom_fences` mermaid entry; `markwright.mermaid` replaces it.
49
+
50
+ ### Fixed
51
+
52
+ - `mw pre` expanded directive lines inside fenced code blocks, so the code showed an iframe or a marker comment instead of the directive.
53
+ The six embeds, `button`, `lightbox`, `grid`, and `annotate` now leave a directive literal inside a fence, matching the in-process render (#20).
54
+ - `mw pre` now reads a tab as four columns when scanning fences, so a tab-indented fence inside a list item is code to every pre stage, matching the in-process render (#29).
55
+ `mw pre` and the in-process render both leave a directive line inside a top-level indented code block literal.
56
+ Before this, both expanded the embed, button, or lightbox out of the code block, and `grid` and `annotate` wrote their marker into it (#29).
57
+ - `mw pre` wrapped a `<^>` pair inside a top-level indented code block in `<mark>`.
58
+ It now leaves the pair as written, as it does inside a fence, and `mw post` marks it.
59
+ - A fence with `line_numbers` after a `command`, `super_user`, or `custom_prefix` flag no longer carries the earlier flag's prefix value in its marker.
60
+ - Highlight no longer wraps markers inside `<title>` and `<textarea>`, where the browser shows the tag as text.
61
+ - `mw pre` passes a leading YAML (`---`) or TOML (`+++`) front matter block through untouched.
62
+ - `mw` reads and writes UTF-8 whatever the locale.
63
+ For `mw pre`, `mw post`, and `mw render`, a decode error, a closed stream, a broken pipe, and an unreadable icon file are each one `mw: error:` line and exit 2 instead of a traceback.
64
+ An unreadable or non-UTF-8 config file is the same for `mw config` and for those three.
65
+
66
+ ## [0.3.0] - 2026-10-11
67
+
68
+ Two opt-in features (a config API for host tools and click-to-load embeds), one rule for every config list, a round of correctness fixes, and Python 3.15 support.
69
+ With default settings, output is unchanged for documents 0.2.0 already rendered correctly; the differences are the fixes listed below.
70
+
71
+ ### Upgrading from 0.2.0
72
+
73
+ - `enable = []` now runs no extensions, and `fence.allowed_environments = []` now allows no environments; both used to mean "everything".
74
+ Both now emit a `ConfigWarning`.
75
+ Omit the key to get the old behavior.
76
+ - Config validation is stricter: an option key an extension does not take, a `load` value it does not support, or a non-list `fence.allowed_environments` is now a `ConfigError` (`mw` exits 2 with an `mw: error:` line) instead of being ignored.
77
+ - Python API renames, if you call the stage functions directly: the `warnings` parameter of `apply_html` and `registry.run_post` is now `skip_reasons`, and `highlight.apply_html`'s first parameter is now `rendered_html`.
78
+ - Removed APIs: `registry.select_extensions`, `registry.OPTION_CHECKS`, `registry.LOAD_MODES`, and the `*_SIGNATURE` constants (see Removed).
79
+ - New runtime dependency `pydantic>=2.14.1`, and the `pymdown-extensions` floor rises to 11.0.1.
80
+
81
+ ### Added
82
+
83
+ - A public config API for host tools: `config_from_mapping(table, source)` validates an already-parsed markwright table with the same rules as `markwright.toml`, `selected_extensions(config)` applies `enable` and `disable`, and `extension_configs(config, names)` builds the `extension_configs` argument for `markdown.Markdown`.
84
+ The package root re-exports these with `Config`, `ConfigError`, `ConfigWarning`, and `OptionError`.
85
+ `mw render` uses the same functions.
86
+ - A `load` option on the `youtube`, `codepen`, `twitter`, and `instagram` embeds.
87
+ `eager` is the default and unchanged.
88
+ `click` emits a versioned click-to-load preview with the live markup inside a `<template>`, so nothing reaches the provider until a host script loads it.
89
+ `lazy` (YouTube only) adds `loading="lazy"` to the iframe.
90
+ Provider scripts are injected only when at least one embed of that kind on the page is eager.
91
+ - A Click-to-Load docs page with the markup contract, the provider processor calls (checked against the providers' live scripts), and a sample host script.
92
+ - `mw config` reports the resolved `load` for each embed and where it came from.
93
+ - `markwright.ConfigWarning`, emitted when a setting turns a feature into a no-op (an empty selection or an empty `allowed_environments`).
94
+ It never raises unless you escalate it, for example with `warnings.simplefilter("error", ConfigWarning)`.
95
+ `mw` prints it as one `mw: warning:` line on stderr.
96
+ - `markwright.OptionError`, a `ValueError` subclass raised for an invalid extension option value.
97
+ - Config Rules in the configuration docs: omitting a key means its default, a list names exactly what it holds, a no-op setting warns, and every option is validated.
98
+ - Python 3.15 support, tested in CI.
99
+
100
+ ### Changed
101
+
102
+ - `enable = []` runs no extensions and `fence.allowed_environments = []` allows no environments, each with a `ConfigWarning`; both used to mean "everything" (#13).
103
+ - Config validation runs each extension's own option checks and rejects option keys an extension does not take; an unknown key used to pass through and crash `mw render` with a `KeyError` traceback.
104
+ - `mw` reports config problems as one `mw: error:` line with exit code 2, including a `ConfigWarning` escalated with `python -W error`, and prints only markwright's own warnings as `mw: warning:` lines.
105
+ - A config value of null (a YAML key with no value) counts as omitted.
106
+ - `apply_html` and `registry.run_post` take per-extension options, mirroring `expand_source` and `run_pre`, and name their skip-reason list `skip_reasons`.
107
+ - The post stages read rendered HTML with the stdlib `html.parser` instead of regex and edit only the spans they change.
108
+ - Fence directives and prose highlights find fenced code by CommonMark's rules, through one scanner shared by both pre stages.
109
+ - `registry.REGISTRY` holds pydantic `StageSpec` models, and the embed flag settings are pydantic models.
110
+
111
+ ### Removed
112
+
113
+ - `registry.select_extensions`; selection lives in `config.selected_extensions`.
114
+ - `registry.OPTION_CHECKS` and `registry.LOAD_MODES`; each `StageSpec` carries its option checker, and `LOAD_MODES` stays on each embed module.
115
+ - The `CODEPEN_SIGNATURE`, `TWITTER_SIGNATURE`, and `INSTAGRAM_SIGNATURE` constants, replaced by `*_EMBED_CLASS` (the bare class name).
116
+
117
+ ### Fixed
118
+
119
+ - Fence directives apply to fences indented up to three spaces and to fences inside list items; they used to render as literal code text.
120
+ - A fence marker whose JSON is valid but the wrong shape (`[1]`, `null`, a numeric `label`) is skipped with a warning instead of crashing the post stage with `AttributeError`.
121
+ - Each fence marker styles only its own code block, so a marker with no block can no longer style the next marker's.
122
+ - `fence.label_class` and `secondary_label_class` apply in `mw post`; the pipeline used to drop them while `mw render` honored them.
123
+ - The fence extension reads its options when it registers, so a `setConfig` call after construction applies.
124
+ - A highlight marker inside an HTML attribute (for example `title="&lt;^&gt;"`) is no longer wrapped in `<mark>`, which produced broken markup.
125
+ - A `<^>` marker inside a fence nested in a longer fence is no longer highlighted by `mw pre`, and inline code spans of two or more backticks are skipped like single-backtick ones.
126
+ - An unclosed fence is no longer treated as code by the pre stages, matching `pymdownx.superfences`.
127
+ - An empty extension selection (from `enable = []`, a `disable` listing every extension, or `--exclude`) warns with its cause instead of passing input through silently.
128
+
129
+ ### Security
130
+
131
+ - Requires `pymdown-extensions>=11.0.1` (was `>=10.5`), the first release without PYSEC-2026-3654.
132
+
133
+ ## [0.2.0] - 2026-09-23
134
+
135
+ ### Added
136
+
137
+ - The config system: `markwright.toml` or `[tool.markwright]` discovery, `enable`/`disable`, per-extension options, `warn`, and the `mw config` command.
138
+
139
+ ### Removed
140
+
141
+ - The `mw --use` flag; its allowlist lives in config as `enable`.
142
+
143
+ ## [0.1.0] - 2026-09-15
144
+
145
+ ### Added
146
+
147
+ - First release: the highlight, fence, YouTube, CodePen, Twitter, Instagram, slideshow, and image compare extensions, and the `mw` pipeline CLI.
148
+
149
+ [0.4.0]: https://github.com/MasonEgger/markwright/compare/v0.3.0...v0.4.0
150
+ [0.3.0]: https://github.com/MasonEgger/markwright/compare/v0.2.0...v0.3.0
151
+ [0.2.0]: https://github.com/MasonEgger/markwright/compare/v0.1.0...v0.2.0
152
+ [0.1.0]: https://github.com/MasonEgger/markwright/releases/tag/v0.1.0
@@ -3,18 +3,20 @@ Copyright 2026 Mason Egger
3
3
 
4
4
  markwright as a whole is distributed under the MIT License (see LICENSE).
5
5
 
6
- This project is a Python port of do-markdownit, originally developed by
7
- DigitalOcean and licensed under the Apache License, Version 2.0.
6
+ Part of this project is a Python port of do-markdownit, originally
7
+ developed by DigitalOcean and licensed under the Apache License,
8
+ Version 2.0.
8
9
 
9
10
  Original project: https://github.com/digitalocean/do-markdownit
10
11
  Copyright 2023 DigitalOcean
11
12
 
12
13
  Portions of this project are derived from do-markdownit and remain subject
13
14
  to the Apache License, Version 2.0, a copy of which is included in this
14
- repository as LICENSE-Apache-2.0. The extensions reproduce do-markdownit's
15
- markup syntax and HTML output, and specific portions were ported from the
16
- original source: the compare control SVG, the slideshow navigation script,
17
- and the Twitter and Instagram embed URL grammars.
15
+ repository as LICENSE-Apache-2.0. The highlight, fence, youtube, codepen,
16
+ twitter, instagram, slideshow, and image_compare extensions reproduce
17
+ do-markdownit's markup syntax and HTML output, and specific portions were
18
+ ported from the original source: the compare control SVG, the slideshow
19
+ navigation script, and the Twitter and Instagram embed URL grammars.
18
20
 
19
21
  Significant changes from the original (Apache License, Version 2.0,
20
22
  Section 4(b)):
@@ -25,3 +27,6 @@ Section 4(b)):
25
27
  post filter stages for use outside an in-process Python-Markdown render.
26
28
  - Adapted extension behavior and output where the Python-Markdown
27
29
  toolchain differs from markdown-it.
30
+ - Added extensions that are not ported from do-markdownit (button,
31
+ lightbox, mermaid, icons, grid, annotate, tabs), click-to-load embed
32
+ previews, and a configuration system.
@@ -1,27 +1,27 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: markwright
3
- Version: 0.2.0
4
- Summary: Python-Markdown extensions ported from DigitalOcean's do-markdownit
5
- Keywords: markdown,python-markdown,do-markdownit,mkdocs,hugo
6
- Author: Mason Egger
3
+ Version: 0.4.0
4
+ Summary: Python-Markdown extensions and a pipeline CLI for author-friendly Markdown, inspired by DigitalOcean's do-markdownit
5
+ Project-URL: Homepage, https://github.com/MasonEgger/markwright
6
+ Project-URL: Repository, https://github.com/MasonEgger/markwright
7
+ Project-URL: Documentation, https://masonegger.github.io/markwright/
7
8
  Author-email: Mason Egger <mason@masonegger.com>
8
9
  License-Expression: MIT
9
10
  License-File: LICENSE
10
11
  License-File: LICENSE-Apache-2.0
11
12
  License-File: NOTICE
12
- Classifier: License :: OSI Approved :: MIT License
13
+ Keywords: do-markdownit,hugo,markdown,mkdocs,python-markdown
13
14
  Classifier: Programming Language :: Python :: 3 :: Only
14
15
  Classifier: Programming Language :: Python :: 3.11
15
16
  Classifier: Programming Language :: Python :: 3.12
16
17
  Classifier: Programming Language :: Python :: 3.13
17
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
18
20
  Classifier: Topic :: Text Processing :: Markup :: Markdown
19
- Requires-Dist: markdown>=3.4
20
- Requires-Dist: pymdown-extensions>=10.5
21
21
  Requires-Python: >=3.11
22
- Project-URL: Homepage, https://github.com/MasonEgger/markwright
23
- Project-URL: Repository, https://github.com/MasonEgger/markwright
24
- Project-URL: Documentation, https://masonegger.github.io/markwright/
22
+ Requires-Dist: markdown>=3.8.2
23
+ Requires-Dist: pydantic>=2.14.1
24
+ Requires-Dist: pymdown-extensions>=11.0.1
25
25
  Description-Content-Type: text/markdown
26
26
 
27
27
  # markwright
@@ -29,8 +29,8 @@ Description-Content-Type: text/markdown
29
29
  markwright is a set of [Python-Markdown](https://python-markdown.github.io/) extensions plus a companion command-line tool, `mw`, for author-friendly markdown: highlighted text, labeled code fences, and a set of media embeds.
30
30
  Use the extensions in any tool built on Python-Markdown (including [MkDocs](https://www.mkdocs.org/), Flask, or a plain script), or the `mw` pipeline in toolchains that are not, like Hugo.
31
31
 
32
- The author-facing syntax and HTML output are derived from DigitalOcean's [`do-markdownit`](https://github.com/digitalocean/do-markdownit), so rendered pages match what DigitalOcean produces.
33
- markwright ports those extensions to Python-Markdown and adds its own pieces on top, most notably the `mw` CLI, which runs the same extensions as pre and post filters around any renderer.
32
+ Part of markwright is a port: the highlight, fence, and media embed extensions reproduce the syntax and HTML output of DigitalOcean's [`do-markdownit`](https://github.com/digitalocean/do-markdownit).
33
+ Everything else is markwright's own: buttons, lightboxes, Mermaid diagrams, icons, grids and cards, annotations, tabs, click-to-load embeds, a config system, and the `mw` CLI, which runs the same extensions as pre and post filters around any renderer.
34
34
 
35
35
  Full documentation and a live demo: https://masonegger.github.io/markwright/
36
36
 
@@ -46,6 +46,20 @@ Each extension is standalone and can be loaded on its own or alongside the other
46
46
  - **Instagram** embeds a post with caption and alignment options.
47
47
  - **Slideshow** builds an image slideshow with navigation arrows.
48
48
  - **Image Compare** renders two images with a draggable before/after slider.
49
+ - **Button** turns `[button URL TEXT]` into a link styled as a button.
50
+ - **Lightbox** turns `[lightbox URL ALT]` into an image link a host script can open in an overlay.
51
+ - **Mermaid** turns a `mermaid` code fence into a `<pre class="mermaid">` block a host script draws.
52
+ - **Icons** replaces `:pack-name:` shortcodes with inline SVG from directories you configure.
53
+ - **Grid** classes the list after `[grid]` or `[grid cards]`, wraps the blocks between `[grid]` and `[/grid]` as grid cells with `[card]` ... `[/card]` cards inside, and sets a 1-to-6 column count with `[grid N]`.
54
+ - **Annotate** links `(N)` markers in a code block to the items of the numbered list after it.
55
+ - **Tabs** groups consecutive `[tab NAME]` ... `[/tab]` blocks into one tabbed set.
56
+
57
+ The seven material-style extensions (Button, Lightbox, Mermaid, Icons, Grid, Annotate, Tabs) emit plain `mw-` classes and markup.
58
+ markwright ships no CSS, JavaScript, or icons; the host site supplies them, and the docs site is a worked example.
59
+
60
+ The embeds that contact a third party (YouTube, CodePen, Twitter, Instagram) take a `load` option.
61
+ `load = "click"` renders an inert preview so nothing reaches the provider until the reader asks; see [Click-to-Load](https://masonegger.github.io/markwright/click-to-load/).
62
+ A host tool can validate a markwright config table from its own config file with `markwright.config_from_mapping`; see [Configuration](https://masonegger.github.io/markwright/config/).
49
63
 
50
64
  ## Installation
51
65
 
@@ -89,6 +103,13 @@ markdown_extensions:
89
103
  - markwright.instagram
90
104
  - markwright.slideshow
91
105
  - markwright.image_compare
106
+ - markwright.button
107
+ - markwright.lightbox
108
+ - markwright.mermaid
109
+ - markwright.icons
110
+ - markwright.grid
111
+ - markwright.annotate
112
+ - markwright.tabs
92
113
  ```
93
114
 
94
115
  ### Standalone
@@ -98,18 +119,27 @@ The extensions work with Python-Markdown directly, so you can use them in any Py
98
119
  ```python
99
120
  import markdown
100
121
 
101
- md = markdown.Markdown(extensions=[
102
- "pymdownx.superfences",
103
- "pymdownx.highlight",
104
- "markwright.highlight",
105
- "markwright.fence",
106
- "markwright.youtube",
107
- "markwright.codepen",
108
- "markwright.twitter",
109
- "markwright.instagram",
110
- "markwright.slideshow",
111
- "markwright.image_compare",
112
- ])
122
+ md = markdown.Markdown(
123
+ extensions=[
124
+ "pymdownx.superfences",
125
+ "pymdownx.highlight",
126
+ "markwright.highlight",
127
+ "markwright.fence",
128
+ "markwright.youtube",
129
+ "markwright.codepen",
130
+ "markwright.twitter",
131
+ "markwright.instagram",
132
+ "markwright.slideshow",
133
+ "markwright.image_compare",
134
+ "markwright.button",
135
+ "markwright.lightbox",
136
+ "markwright.mermaid",
137
+ "markwright.icons",
138
+ "markwright.grid",
139
+ "markwright.annotate",
140
+ "markwright.tabs",
141
+ ]
142
+ )
113
143
 
114
144
  html = md.convert("This has a <^>highlighted word<^> in it.")
115
145
  print(html)
@@ -136,9 +166,10 @@ For a toolchain that is not built on Python-Markdown, the `mw` command runs the
136
166
  mw pre < in.md | your-renderer | mw post > out.html
137
167
  ```
138
168
 
139
- - `mw pre` expands the embeds and extracts fence directives into an `mw-fence` comment.
140
- - `mw post` applies the fence styling, resolves the highlights, and injects each embed script once.
169
+ - `mw pre` expands the embed, button, lightbox, mermaid, and icon directives, and turns the fence, grid, annotate, and tab directives into marker comments.
170
+ - `mw post` reads the markers back to apply the fence, grid, card, annotate, and tab markup, resolves the highlights, and injects each embed script once.
141
171
  - `mw render` runs the full pipeline in one shot for callers without their own renderer.
172
+ It loads no other extension, and its syntax highlighting needs Pygments.
142
173
  - `mw config` prints the resolved configuration and the source of each value.
143
174
  - `mw list` prints every extension and the stages it provides.
144
175
 
@@ -178,21 +209,21 @@ See the [extension docs](https://masonegger.github.io/markwright/) for every fla
178
209
  This project uses [`uv`](https://docs.astral.sh/uv/) and [`just`](https://github.com/casey/just).
179
210
 
180
211
  ```bash
181
- just install # uv sync
182
- just test # unit tests, 100% line + branch coverage
183
- just test-integration # end-to-end Hugo pipeline test (needs hugo)
184
- just lint # ruff check + ruff format --check
185
- just typecheck # mypy --strict
186
- just check # test + lint + typecheck
212
+ just check # the gate: ruff check, ruff format --check, mypy strict, pytest
213
+ just fmt # format and auto-fix
214
+ just test # pytest (integration tests skip without hugo on PATH)
215
+ just test-all # pytest across Python 3.11 through 3.15
216
+ just test-integration # only the end-to-end Hugo and clean-install tests
187
217
  just docs-serve # serve the docs site at localhost:8000
188
218
  ```
189
219
 
190
220
  `just check` must pass before a change is complete.
191
- The tooling bar is strict: `mypy --strict`, a clean `ruff`, and full test coverage.
221
+ Coverage is reported on every run.
192
222
 
193
223
  ## License
194
224
 
195
225
  markwright is released under the [MIT License](LICENSE).
196
226
 
197
- It is a port of [`do-markdownit`](https://github.com/digitalocean/do-markdownit) by DigitalOcean, which is licensed under the Apache License 2.0.
227
+ Part of it is a port of [`do-markdownit`](https://github.com/digitalocean/do-markdownit) by DigitalOcean, which is licensed under the Apache License 2.0.
228
+ Those portions remain subject to that license, a copy of which is included as [LICENSE-Apache-2.0](LICENSE-Apache-2.0).
198
229
  See the [NOTICE](NOTICE) file for attribution details.
@@ -3,8 +3,8 @@
3
3
  markwright is a set of [Python-Markdown](https://python-markdown.github.io/) extensions plus a companion command-line tool, `mw`, for author-friendly markdown: highlighted text, labeled code fences, and a set of media embeds.
4
4
  Use the extensions in any tool built on Python-Markdown (including [MkDocs](https://www.mkdocs.org/), Flask, or a plain script), or the `mw` pipeline in toolchains that are not, like Hugo.
5
5
 
6
- The author-facing syntax and HTML output are derived from DigitalOcean's [`do-markdownit`](https://github.com/digitalocean/do-markdownit), so rendered pages match what DigitalOcean produces.
7
- markwright ports those extensions to Python-Markdown and adds its own pieces on top, most notably the `mw` CLI, which runs the same extensions as pre and post filters around any renderer.
6
+ Part of markwright is a port: the highlight, fence, and media embed extensions reproduce the syntax and HTML output of DigitalOcean's [`do-markdownit`](https://github.com/digitalocean/do-markdownit).
7
+ Everything else is markwright's own: buttons, lightboxes, Mermaid diagrams, icons, grids and cards, annotations, tabs, click-to-load embeds, a config system, and the `mw` CLI, which runs the same extensions as pre and post filters around any renderer.
8
8
 
9
9
  Full documentation and a live demo: https://masonegger.github.io/markwright/
10
10
 
@@ -20,6 +20,20 @@ Each extension is standalone and can be loaded on its own or alongside the other
20
20
  - **Instagram** embeds a post with caption and alignment options.
21
21
  - **Slideshow** builds an image slideshow with navigation arrows.
22
22
  - **Image Compare** renders two images with a draggable before/after slider.
23
+ - **Button** turns `[button URL TEXT]` into a link styled as a button.
24
+ - **Lightbox** turns `[lightbox URL ALT]` into an image link a host script can open in an overlay.
25
+ - **Mermaid** turns a `mermaid` code fence into a `<pre class="mermaid">` block a host script draws.
26
+ - **Icons** replaces `:pack-name:` shortcodes with inline SVG from directories you configure.
27
+ - **Grid** classes the list after `[grid]` or `[grid cards]`, wraps the blocks between `[grid]` and `[/grid]` as grid cells with `[card]` ... `[/card]` cards inside, and sets a 1-to-6 column count with `[grid N]`.
28
+ - **Annotate** links `(N)` markers in a code block to the items of the numbered list after it.
29
+ - **Tabs** groups consecutive `[tab NAME]` ... `[/tab]` blocks into one tabbed set.
30
+
31
+ The seven material-style extensions (Button, Lightbox, Mermaid, Icons, Grid, Annotate, Tabs) emit plain `mw-` classes and markup.
32
+ markwright ships no CSS, JavaScript, or icons; the host site supplies them, and the docs site is a worked example.
33
+
34
+ The embeds that contact a third party (YouTube, CodePen, Twitter, Instagram) take a `load` option.
35
+ `load = "click"` renders an inert preview so nothing reaches the provider until the reader asks; see [Click-to-Load](https://masonegger.github.io/markwright/click-to-load/).
36
+ A host tool can validate a markwright config table from its own config file with `markwright.config_from_mapping`; see [Configuration](https://masonegger.github.io/markwright/config/).
23
37
 
24
38
  ## Installation
25
39
 
@@ -63,6 +77,13 @@ markdown_extensions:
63
77
  - markwright.instagram
64
78
  - markwright.slideshow
65
79
  - markwright.image_compare
80
+ - markwright.button
81
+ - markwright.lightbox
82
+ - markwright.mermaid
83
+ - markwright.icons
84
+ - markwright.grid
85
+ - markwright.annotate
86
+ - markwright.tabs
66
87
  ```
67
88
 
68
89
  ### Standalone
@@ -72,18 +93,27 @@ The extensions work with Python-Markdown directly, so you can use them in any Py
72
93
  ```python
73
94
  import markdown
74
95
 
75
- md = markdown.Markdown(extensions=[
76
- "pymdownx.superfences",
77
- "pymdownx.highlight",
78
- "markwright.highlight",
79
- "markwright.fence",
80
- "markwright.youtube",
81
- "markwright.codepen",
82
- "markwright.twitter",
83
- "markwright.instagram",
84
- "markwright.slideshow",
85
- "markwright.image_compare",
86
- ])
96
+ md = markdown.Markdown(
97
+ extensions=[
98
+ "pymdownx.superfences",
99
+ "pymdownx.highlight",
100
+ "markwright.highlight",
101
+ "markwright.fence",
102
+ "markwright.youtube",
103
+ "markwright.codepen",
104
+ "markwright.twitter",
105
+ "markwright.instagram",
106
+ "markwright.slideshow",
107
+ "markwright.image_compare",
108
+ "markwright.button",
109
+ "markwright.lightbox",
110
+ "markwright.mermaid",
111
+ "markwright.icons",
112
+ "markwright.grid",
113
+ "markwright.annotate",
114
+ "markwright.tabs",
115
+ ]
116
+ )
87
117
 
88
118
  html = md.convert("This has a <^>highlighted word<^> in it.")
89
119
  print(html)
@@ -110,9 +140,10 @@ For a toolchain that is not built on Python-Markdown, the `mw` command runs the
110
140
  mw pre < in.md | your-renderer | mw post > out.html
111
141
  ```
112
142
 
113
- - `mw pre` expands the embeds and extracts fence directives into an `mw-fence` comment.
114
- - `mw post` applies the fence styling, resolves the highlights, and injects each embed script once.
143
+ - `mw pre` expands the embed, button, lightbox, mermaid, and icon directives, and turns the fence, grid, annotate, and tab directives into marker comments.
144
+ - `mw post` reads the markers back to apply the fence, grid, card, annotate, and tab markup, resolves the highlights, and injects each embed script once.
115
145
  - `mw render` runs the full pipeline in one shot for callers without their own renderer.
146
+ It loads no other extension, and its syntax highlighting needs Pygments.
116
147
  - `mw config` prints the resolved configuration and the source of each value.
117
148
  - `mw list` prints every extension and the stages it provides.
118
149
 
@@ -152,21 +183,21 @@ See the [extension docs](https://masonegger.github.io/markwright/) for every fla
152
183
  This project uses [`uv`](https://docs.astral.sh/uv/) and [`just`](https://github.com/casey/just).
153
184
 
154
185
  ```bash
155
- just install # uv sync
156
- just test # unit tests, 100% line + branch coverage
157
- just test-integration # end-to-end Hugo pipeline test (needs hugo)
158
- just lint # ruff check + ruff format --check
159
- just typecheck # mypy --strict
160
- just check # test + lint + typecheck
186
+ just check # the gate: ruff check, ruff format --check, mypy strict, pytest
187
+ just fmt # format and auto-fix
188
+ just test # pytest (integration tests skip without hugo on PATH)
189
+ just test-all # pytest across Python 3.11 through 3.15
190
+ just test-integration # only the end-to-end Hugo and clean-install tests
161
191
  just docs-serve # serve the docs site at localhost:8000
162
192
  ```
163
193
 
164
194
  `just check` must pass before a change is complete.
165
- The tooling bar is strict: `mypy --strict`, a clean `ruff`, and full test coverage.
195
+ Coverage is reported on every run.
166
196
 
167
197
  ## License
168
198
 
169
199
  markwright is released under the [MIT License](LICENSE).
170
200
 
171
- It is a port of [`do-markdownit`](https://github.com/digitalocean/do-markdownit) by DigitalOcean, which is licensed under the Apache License 2.0.
201
+ Part of it is a port of [`do-markdownit`](https://github.com/digitalocean/do-markdownit) by DigitalOcean, which is licensed under the Apache License 2.0.
202
+ Those portions remain subject to that license, a copy of which is included as [LICENSE-Apache-2.0](LICENSE-Apache-2.0).
172
203
  See the [NOTICE](NOTICE) file for attribution details.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "markwright"
3
- version = "0.2.0"
4
- description = "Python-Markdown extensions ported from DigitalOcean's do-markdownit"
3
+ version = "0.4.0"
4
+ description = "Python-Markdown extensions and a pipeline CLI for author-friendly Markdown, inspired by DigitalOcean's do-markdownit"
5
5
  readme = "README.md"
6
6
  authors = [
7
7
  { name = "Mason Egger", email = "mason@masonegger.com" }
@@ -10,17 +10,18 @@ requires-python = ">=3.11"
10
10
  license = "MIT"
11
11
  license-files = ["LICENSE", "LICENSE-Apache-2.0", "NOTICE"]
12
12
  dependencies = [
13
- "markdown>=3.4",
14
- "pymdown-extensions>=10.5",
13
+ "markdown>=3.8.2",
14
+ "pydantic>=2.14.1",
15
+ "pymdown-extensions>=11.0.1",
15
16
  ]
16
17
  keywords = ["markdown", "python-markdown", "do-markdownit", "mkdocs", "hugo"]
17
18
  classifiers = [
18
- "License :: OSI Approved :: MIT License",
19
19
  "Programming Language :: Python :: 3 :: Only",
20
20
  "Programming Language :: Python :: 3.11",
21
21
  "Programming Language :: Python :: 3.12",
22
22
  "Programming Language :: Python :: 3.13",
23
23
  "Programming Language :: Python :: 3.14",
24
+ "Programming Language :: Python :: 3.15",
24
25
  "Topic :: Text Processing :: Markup :: Markdown",
25
26
  ]
26
27
 
@@ -41,25 +42,29 @@ dev = [
41
42
  "types-markdown>=3.10.2.20260211",
42
43
  "mkdocs>=1.6,<2",
43
44
  "mkdocs-material>=9.7.5",
45
+ "hypothesis>=6.169.0",
44
46
  ]
45
47
 
46
48
  [build-system]
47
- requires = ["uv_build>=0.9.17,<0.13.0"]
48
- build-backend = "uv_build"
49
+ requires = ["hatchling"]
50
+ build-backend = "hatchling.build"
51
+
52
+ # Hatchling's default sdist is every git-tracked file; ship only the package, its tests, and what licenses it
53
+ [tool.hatch.build.targets.sdist]
54
+ include = ["src/markwright", "tests", "README.md", "CHANGELOG.md", "LICENSE", "LICENSE-Apache-2.0", "NOTICE"]
49
55
 
50
56
  [tool.pytest.ini_options]
51
57
  testpaths = ["tests"]
58
+ addopts = "--cov=markwright --cov-branch --cov-report=term-missing"
52
59
  markers = [
53
60
  "integration: end-to-end tests that require external tools such as Hugo",
54
61
  ]
55
62
 
56
63
  [tool.ruff]
57
- target-version = "py311"
58
64
  line-length = 120
59
65
 
60
66
  [tool.ruff.lint]
61
- select = ["E", "F", "I", "UP", "B", "SIM"]
67
+ select = ["E", "W", "F", "I", "N", "UP", "B", "SIM", "C4", "TC"]
62
68
 
63
69
  [tool.mypy]
64
70
  strict = true
65
- python_version = "3.11"
@@ -0,0 +1,25 @@
1
+ # ABOUTME: Package root for markwright; re-exports the public config API for host tools.
2
+ # Extensions load by name (markwright.<name>) and need nothing from here.
3
+
4
+ from __future__ import annotations
5
+
6
+ from markwright._diagnostics import ConfigWarning, OptionError
7
+ from markwright.config import (
8
+ Config,
9
+ ConfigError,
10
+ config_from_mapping,
11
+ disallowed_environments,
12
+ extension_configs,
13
+ selected_extensions,
14
+ )
15
+
16
+ __all__ = [
17
+ "Config",
18
+ "ConfigError",
19
+ "ConfigWarning",
20
+ "OptionError",
21
+ "config_from_mapping",
22
+ "disallowed_environments",
23
+ "extension_configs",
24
+ "selected_extensions",
25
+ ]