hypermarkdown 0.2.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.
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: hypermarkdown
3
+ Version: 0.2.0
4
+ Summary: A strict, machine-checkable markdown dialect for project knowledge bases.
5
+ Author: Yauhen Yakimovich
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://hypermarkdown.org/
8
+ Project-URL: Documentation, https://hypermarkdown.org/
9
+ Project-URL: Repository, https://github.com/ewiger/hypermarkdown
10
+ Project-URL: Changelog, https://github.com/ewiger/hypermarkdown/blob/main/tools/hmd/CHANGELOG.md
11
+ Project-URL: Issues, https://github.com/ewiger/hypermarkdown/issues
12
+ Keywords: markdown,wiki,knowledge-base,wikilinks,linter,mkdocs,documentation
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Documentation
23
+ Classifier: Topic :: Software Development :: Documentation
24
+ Classifier: Topic :: Text Processing :: Markup :: Markdown
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: typer<1,>=0.12
29
+ Requires-Dist: pyyaml<7,>=6
30
+ Requires-Dist: markdown<4,>=3.6
31
+ Requires-Dist: pymdown-extensions<12,>=10.21.2
32
+ Provides-Extra: mkdocs
33
+ Requires-Dist: mkdocs<2,>=1.6; extra == "mkdocs"
34
+ Requires-Dist: mkdocs-material<10,>=9; extra == "mkdocs"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest<10,>=8; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ <div align="center">
40
+
41
+ <img src="https://raw.githubusercontent.com/ewiger/hypermarkdown/main/doc/wiki/assets/logo.png" width="76" height="76" alt="">
42
+
43
+ # HyperMarkDown
44
+
45
+ **The Python implementation, and the `hmd` command**
46
+
47
+ [![PyPI](https://img.shields.io/pypi/v/hypermarkdown.svg)](https://pypi.org/project/hypermarkdown/)
48
+ [![Python versions](https://img.shields.io/pypi/pyversions/hypermarkdown.svg)](https://pypi.org/project/hypermarkdown/)
49
+ [![CI](https://github.com/ewiger/hypermarkdown/actions/workflows/ci.yml/badge.svg)](https://github.com/ewiger/hypermarkdown/actions/workflows/ci.yml)
50
+ [![Documentation](https://img.shields.io/badge/docs-hypermarkdown.org-ffb300)](https://hypermarkdown.org/)
51
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/ewiger/hypermarkdown/blob/main/tools/hmd/LICENSE)
52
+
53
+ </div>
54
+
55
+ HyperMarkDown (`.hmd`) is ordinary GitHub-flavored markdown plus the part HTML
56
+ had on its first day: a link that means something, a page that can be made out
57
+ of other pages, a document that is part of a web rather than a file in a folder.
58
+ Every `.md` file is already valid `.hmd`, so a tree is adopted one rename at a
59
+ time.
60
+
61
+ This distribution is the **canonical implementation** of that format. It ships
62
+ three things:
63
+
64
+ - **`hmd`**, a command line tool — lint a tree of cards, render one, dump the
65
+ link graph.
66
+ - **the library under it** — scanner, resolver, embed expander, and renderer,
67
+ importable as `hypermarkdown`.
68
+ - **a MkDocs plugin**, installed with the `mkdocs` extra, which builds a tree of
69
+ cards into a website.
70
+
71
+ There is a second implementation in TypeScript for editors. Where the two
72
+ disagree about a case the shared conformance corpus covers, **this one defines
73
+ the answer**.
74
+
75
+ The format itself — every construct, the resolution algorithm, the rule IDs — is
76
+ documented at **[hypermarkdown.org](https://hypermarkdown.org/)**. This page
77
+ is about the tool.
78
+
79
+ ## Install
80
+
81
+ ```bash
82
+ pip install HyperMarkDown # or: uv pip install HyperMarkDown
83
+ pip install "HyperMarkDown[mkdocs]" # with the site builder
84
+ ```
85
+
86
+ Python 3.11 through 3.14.
87
+
88
+ ## Sixty seconds
89
+
90
+ Point `hmd` at a tree of cards and lint it:
91
+
92
+ ```bash
93
+ hmd lint --root path/to/your/wiki
94
+ ```
95
+
96
+ ```text
97
+ glossary/index.hmd:11:3: warning[HMD001] [[idempotency]] does not resolve to a page
98
+
99
+ 0 error(s), 1 warning(s)
100
+ ```
101
+
102
+ Exit codes are pinned for CI: `0` clean, `1` diagnostics, `2` usage error. Add
103
+ `--strict` to fail on warnings, `--format json` for machine-readable output.
104
+
105
+ That output is
106
+ [`examples/small/`](https://github.com/ewiger/hypermarkdown/tree/main/examples/small),
107
+ a runnable wiki that exercises the spine walk, both import forms, `use`
108
+ inheritance, folder notes, and most of the syntax. It lints with zero errors and
109
+ exactly one deliberate warning — the red link above, showing what an unwritten
110
+ page looks like. The fixture travels in the repository rather than in the
111
+ distribution, so try it from a clone:
112
+
113
+ ```bash
114
+ git clone https://github.com/ewiger/hypermarkdown
115
+ hmd lint --root hypermarkdown/examples/small
116
+ ```
117
+
118
+ ## The card it is reading
119
+
120
+ ```markdown
121
+ ---
122
+ tags: [area/auth, status/accepted]
123
+ use: [autodiscovery]
124
+ import:
125
+ - from /shared import tokens as shared-tokens
126
+ - from /glossary import *
127
+ ---
128
+
129
+ # Login
130
+
131
+ - `[[tokens]]` → the sibling card, found on the spine
132
+ - `[[shared-tokens]]` → `shared/tokens.hmd`, a named import under an alias
133
+ - `[[token]]` → `glossary/token.hmd`, via the imported search path
134
+
135
+ See [[shared-tokens#Rotation|the rotation window]], and embed one block rather
136
+ than restating it:
137
+
138
+ ![[token#^definition]]
139
+ ```
140
+
141
+ Six constructs are what the format adds — wikilinks, aliased links, heading
142
+ links, block anchors, block references, and the three embed forms. Four
143
+ frontmatter keys mean something to this tool: `tags`, `use`, `import`, and `nav`.
144
+ Every other key is yours, and nothing will inspect it.
145
+
146
+ ## Commands
147
+
148
+ | Command | What it does |
149
+ | --- | --- |
150
+ | `hmd lint` | Parse, resolve, and report — `HMD001`–`HMD017`, text or JSON |
151
+ | `hmd render` | Expand embeds and rewrite links, to flat markdown or HTML |
152
+ | `hmd graph` | Dump the resolved link graph as JSON |
153
+ | `hmd info` | Show the resolved root and discovery policy |
154
+ | `hmd --version` | Print the installed version |
155
+
156
+ Each takes `--root` to override the namespace root, which otherwise comes from
157
+ the `wiki` setting in `.hmd/config.toml` (defaulting to `doc/wiki`). A `.hmd/`
158
+ directory doubles as the project root marker, so any subtree can be
159
+ self-contained.
160
+
161
+ `hmd render --to markdown` is **one-way** on purpose. Flattening a card erases
162
+ the embed boundary and the provenance of every link, which is right for
163
+ something you are shipping and wrong for something you are still editing.
164
+
165
+ ## The linter refuses to guess
166
+
167
+ A wiki that guesses is a wiki that quietly rots, because a link that silently
168
+ changes meaning is indistinguishable from one that did not:
169
+
170
+ ```text
171
+ specs/auth/login.hmd:14:5: error[HMD002] [[tokens]] matches 2 pages; qualify it
172
+ (candidates: shared/tokens.hmd, specs/auth/tokens.hmd)
173
+ ```
174
+
175
+ The distinction it draws is a compiler's. A link to a page you have not written
176
+ yet is a **warning** — writing forward is how a wiki grows, so it renders as a
177
+ red link instead of breaking the build. A malformed link or multiple
178
+ autodiscovery matches is an **error**. Ordered wildcard imports instead use
179
+ declaration precedence and report shadowing as HMD016.
180
+
181
+ Resolution runs in phases and stops at the first hit: explicit imports, then the
182
+ **spine** — this folder, then each folder above it, probed without recursion —
183
+ then imported search paths, then one sweep of the whole tree. A bare name
184
+ is a one-segment reference such as `[[tokens]]`; `[[shared/tokens]]` is an
185
+ unqualified path, not a bare name. The spine never searches sideways, but if
186
+ the earlier phases miss, autodiscovery may resolve a unique card elsewhere in
187
+ the namespace. Use `[[/shared/tokens]]` to make that dependency explicit.
188
+
189
+ ## Publish it: a book with a wiki in it
190
+
191
+ The `mkdocs` extra registers a plugin through the `mkdocs.plugins` entry point.
192
+ It registers `.hmd` files as pages, derives the nav from the namespace tree,
193
+ expands embeds, and rewrites every wikilink to a source-relative link that
194
+ MkDocs resolves and validates itself:
195
+
196
+ ```bash
197
+ pip install "HyperMarkDown[mkdocs]"
198
+ mkdocs build --strict # or: mkdocs serve
199
+ ```
200
+
201
+ The namespace does not have to be the whole site, and a wiki on its own is not
202
+ the interesting case — a **book with a wiki inside it** is. Point `docs_dir` at a
203
+ documentation tree and `root` at the part of it that is a namespace: the book is
204
+ hand-ordered markdown, the wiki is generated, and `hmd://wiki` says where the
205
+ generated section belongs in your nav.
206
+
207
+ ```yaml
208
+ # mkdocs.yml
209
+ docs_dir: doc
210
+ plugins:
211
+ - HyperMarkDown:
212
+ root: doc/wiki # only this subtree is a namespace
213
+ exclude_docs: |
214
+ *.hmd
215
+
216
+ nav:
217
+ - Home: index.md
218
+ - Introduction: public/introduction.md
219
+ - Wiki:
220
+ - Overview: wiki/README.md
221
+ - hmd://wiki # ← the derived section lands here
222
+ ```
223
+
224
+ An authored nav wins everywhere except where it names the wiki. Omit the
225
+ placeholder and your nav is used verbatim; omit `nav` entirely and the whole
226
+ thing is derived from the namespace tree. A card at `a/b.hmd` serves at `a/b/`,
227
+ and so does a folder note at `a/b/index.hmd` — two names for one page, one URL.
228
+ Unresolved links render red rather than failing the build, so a wiki stays
229
+ publishable while it is still being written.
230
+
231
+ Publication is opt-in: `nav: {visibility: public}` is what puts a card on the
232
+ site, it inherits down a subtree from a folder note, and the default is private.
233
+ The failure mode is a missing page, never an unintended one.
234
+
235
+ [hypermarkdown.org](https://hypermarkdown.org/) is that build, from this
236
+ repository's own `doc/` tree.
237
+
238
+ ## Math, diagrams, callouts
239
+
240
+ TeX mathematics, D2 diagrams, callouts, tables, task lists, footnotes,
241
+ strikethrough. None of these are HyperMarkDown's own — they are the tier the
242
+ wider markdown world settled on, and both `hmd render --to html` and the site
243
+ build assume them present.
244
+
245
+ Diagrams go through the [`d2`](https://d2lang.com) binary, which is deliberately
246
+ *not* a Python dependency: without it a diagram degrades to its own labelled
247
+ source rather than failing the build.
248
+
249
+ ## The library
250
+
251
+ ```python
252
+ from pathlib import Path
253
+
254
+ from hypermarkdown import Workspace, config
255
+ from hypermarkdown.lint import check
256
+
257
+ workspace = Workspace(config.load(root_override=Path("doc/wiki")))
258
+ for diagnostic in check(workspace):
259
+ print(diagnostic.path, diagnostic.rule, diagnostic.message)
260
+ ```
261
+
262
+ `parse`, `resolve`, `embed`, `urls`, and `lint` do not import MkDocs — the
263
+ plugin is one file, `mkdocs_plugin.py`, and swapping the renderer is that file
264
+ plus a `mkdocs.yml` rather than a re-specification. Every entry point that
265
+ ingests a document takes the document's *text*, not only a path, because the
266
+ language server this package will grow serves buffers that have never been
267
+ saved.
268
+
269
+ ## Versioning
270
+
271
+ Semantic, with the usual `0.x` caveat made explicit: **the format itself may
272
+ change between minor versions.** Until `1.0`, treat a minor bump as potentially
273
+ breaking for `.hmd` sources, not only for the Python API. What each release
274
+ changed, and what is deliberately not implemented, is in
275
+ [CHANGELOG.md](https://github.com/ewiger/hypermarkdown/blob/main/tools/hmd/CHANGELOG.md).
276
+
277
+ ## Development
278
+
279
+ This tool is `tools/hmd/` in the
280
+ [HyperMarkDown monorepo](https://github.com/ewiger/hypermarkdown), whose root
281
+ is a uv workspace:
282
+
283
+ ```bash
284
+ git clone https://github.com/ewiger/hypermarkdown
285
+ cd HyperMarkDown
286
+ uv sync --locked
287
+ uv run python -m pytest
288
+ ```
289
+
290
+ Build the wheel with `uv build --package HyperMarkDown` — the `--package` flag
291
+ is load-bearing, since a bare `uv build` at a workspace root produces an empty
292
+ `unknown-0.0.0` and exits zero.
293
+
294
+ - **[tools/hmd/DEVELOP.md](https://github.com/ewiger/hypermarkdown/blob/main/tools/hmd/DEVELOP.md)**
295
+ — this tool's own guide: the test loop, the gates, dependency policy,
296
+ packaging, and how a release is cut.
297
+ - **[DEVELOP.md](https://github.com/ewiger/hypermarkdown/blob/main/DEVELOP.md)**
298
+ — the repository's: the layout, how the documentation tree is organised, where
299
+ progress is tracked, and how the site is published.
300
+
301
+ ## License
302
+
303
+ MIT — see [LICENSE](https://github.com/ewiger/hypermarkdown/blob/main/tools/hmd/LICENSE).
@@ -0,0 +1,25 @@
1
+ hypermarkdown/__init__.py,sha256=YC3eVTV2ro5G9rSbaOVIy2zZV9acl5jvtW_t48UoKcU,984
2
+ hypermarkdown/cli.py,sha256=-JjoS5z0B-UAPkpb8mMuRncml5Lkz9Zrvw16__WnrZw,6091
3
+ hypermarkdown/config.py,sha256=81nsy66Mj0ZeTYfQTMaM0S_pcwUtSUHilrlpoY5L74Y,3559
4
+ hypermarkdown/diagram.py,sha256=k2HmadRjC4XR_U_iQY0B3dgKv118LVqQ0w-_ehPaOro,6343
5
+ hypermarkdown/embed.py,sha256=KnqWS2bgjWI-StksrmqNsgHuDP0JAaYOylbPlXNQBgs,8107
6
+ hypermarkdown/frontmatter.py,sha256=MLgZqQlmjJNqCRaQPSHlrttU0IEvNoCDK4pXAh__SUM,6830
7
+ hypermarkdown/graph.py,sha256=AgJNKqmOzvI0kU_c99BZ45q5oX2bB1WL4I1KgxAXJ2o,2681
8
+ hypermarkdown/imports.py,sha256=iJbEW_BZ30nrcCSO9dTwbR_ch0DQs--DeYquchHPpVM,2198
9
+ hypermarkdown/mkdocs_plugin.py,sha256=IPcLN5yg4_tB0rYSmDCeJfYmeQthCzrttHrIOaU4Crc,14245
10
+ hypermarkdown/model.py,sha256=V_mxtvnDh-PMJ4IXAzmz66jO7amswMu5Hb2STCrw2aA,4160
11
+ hypermarkdown/parse.py,sha256=5bGa-xE_FnrQaHzE9uC8wyTZ2Jj7RzfXBdzWf-H26JA,5888
12
+ hypermarkdown/resolve.py,sha256=xHByw7nhRB1HEhPo2Asby0nu5L5Ql60xHBVKjPMX26A,12999
13
+ hypermarkdown/scan.py,sha256=HYsZDtW6foK9zTFNobQSN65nwY07iljoIE3YUZOsXUQ,6142
14
+ hypermarkdown/urls.py,sha256=xvrgEok7fk063nuFe44vQ5FkHc1hn52iemoi0l2TKRw,2267
15
+ hypermarkdown/lint/__init__.py,sha256=5IxJzw-j-S8ywKZo2XgeoQOO9vTgsrfFJNycMzMDnyE,194
16
+ hypermarkdown/lint/report.py,sha256=ovxuz6Bp1eiC4tK9RJA3dMGbEnrs8AqSDe1Y8a1iuh8,1479
17
+ hypermarkdown/lint/rules.py,sha256=C_JOKIJ2QFTxaWc2inKUqDwsop52LmuSv4FGnV052sA,9086
18
+ hypermarkdown/render/__init__.py,sha256=aLexs0wia0cQFgXI7LkUxc9vM_wYqyI0FUPoVX1SAEE,140
19
+ hypermarkdown/render/flat.py,sha256=NG6n4dfIcKYgAwI8RIVP2CbHm0JwratK0W9dXo6xtQw,2669
20
+ hypermarkdown-0.2.0.dist-info/licenses/LICENSE,sha256=Nere342rnt6FQN5RQJDC42BYe-eRGolSOyxkdE0aBLY,1074
21
+ hypermarkdown-0.2.0.dist-info/METADATA,sha256=HQCOdC1UDzvCZFmXJRbWuu78Pe31ayuacrcCVzJZY8E,11996
22
+ hypermarkdown-0.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
23
+ hypermarkdown-0.2.0.dist-info/entry_points.txt,sha256=oYyT9w7qeXwQw7-gPWdZ2B8RhfR8f76fkX5GuV7Qgz4,194
24
+ hypermarkdown-0.2.0.dist-info/top_level.txt,sha256=UGkl25cBpK-8O2cMeopyFy7UC7rzfSRaRsnClK9qgCo,14
25
+ hypermarkdown-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,6 @@
1
+ [console_scripts]
2
+ hmd = hypermarkdown.cli:main
3
+
4
+ [mkdocs.plugins]
5
+ hyper-markdown = hypermarkdown.mkdocs_plugin:HyperMarkDownPlugin
6
+ hypermarkdown = hypermarkdown.mkdocs_plugin:HyperMarkDownPlugin
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yauhen Yakimovich
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 @@
1
+ hypermarkdown