md2site-cli 0.2.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 (141) hide show
  1. md2site_cli-0.2.0/.gitattributes +4 -0
  2. md2site_cli-0.2.0/.github/workflows/ci.yml +88 -0
  3. md2site_cli-0.2.0/.github/workflows/pages.yml +47 -0
  4. md2site_cli-0.2.0/.github/workflows/release.yml +98 -0
  5. md2site_cli-0.2.0/.gitignore +32 -0
  6. md2site_cli-0.2.0/AGENTS.md +71 -0
  7. md2site_cli-0.2.0/CHANGELOG.md +43 -0
  8. md2site_cli-0.2.0/CLAUDE.md +1 -0
  9. md2site_cli-0.2.0/LICENSE +21 -0
  10. md2site_cli-0.2.0/PKG-INFO +280 -0
  11. md2site_cli-0.2.0/README.md +244 -0
  12. md2site_cli-0.2.0/THIRD_PARTY_LICENSES.md +36 -0
  13. md2site_cli-0.2.0/docs/AUDIT.md +92 -0
  14. md2site_cli-0.2.0/docs/PRD.md +189 -0
  15. md2site_cli-0.2.0/docs/TODO.md +29 -0
  16. md2site_cli-0.2.0/docs/agents.md +73 -0
  17. md2site_cli-0.2.0/docs/architecture.md +40 -0
  18. md2site_cli-0.2.0/docs/assets/md2site-overview.jpg +0 -0
  19. md2site_cli-0.2.0/docs/cli.md +31 -0
  20. md2site_cli-0.2.0/docs/configuration.md +54 -0
  21. md2site_cli-0.2.0/docs/custom.css +1 -0
  22. md2site_cli-0.2.0/docs/decisions.md +24 -0
  23. md2site_cli-0.2.0/docs/index.md +24 -0
  24. md2site_cli-0.2.0/docs/link-resolution.md +52 -0
  25. md2site_cli-0.2.0/docs/md2site.config.json +16 -0
  26. md2site_cli-0.2.0/docs/prompts/00_MASTER_CONTEXT.md +82 -0
  27. md2site_cli-0.2.0/docs/prompts/01_scaffold_and_cli_skeleton.md +43 -0
  28. md2site_cli-0.2.0/docs/prompts/02_config_scanner_titles_nav.md +50 -0
  29. md2site_cli-0.2.0/docs/prompts/03_markdown_engine.md +48 -0
  30. md2site_cli-0.2.0/docs/prompts/04_link_rewriter_and_diagnostics.md +53 -0
  31. md2site_cli-0.2.0/docs/prompts/05_templates_theme_ui.md +49 -0
  32. md2site_cli-0.2.0/docs/prompts/06_search_mermaid_assets.md +44 -0
  33. md2site_cli-0.2.0/docs/prompts/07_build_init_check_watch.md +43 -0
  34. md2site_cli-0.2.0/docs/prompts/08_agent_skill_and_hooks.md +35 -0
  35. md2site_cli-0.2.0/docs/prompts/09_tests_fixtures_perf.md +39 -0
  36. md2site_cli-0.2.0/docs/prompts/10_readme_docs_image.md +64 -0
  37. md2site_cli-0.2.0/docs/prompts/11_ci_release_ship.md +48 -0
  38. md2site_cli-0.2.0/docs/prompts/12_final_audit.md +34 -0
  39. md2site_cli-0.2.0/docs/prompts/13_v02_query_params_in_doc_links.md +55 -0
  40. md2site_cli-0.2.0/docs/prompts/14_v02_explicit_nav_override.md +69 -0
  41. md2site_cli-0.2.0/docs/prompts/15_v02_large_file_perf_and_search_bounds.md +62 -0
  42. md2site_cli-0.2.0/docs/prompts/16_v02_exact_inline_diagnostic_lines.md +52 -0
  43. md2site_cli-0.2.0/docs/prompts/17_v02_external_out_relative_repo_links.md +65 -0
  44. md2site_cli-0.2.0/docs/prompts/18_v02_release_and_audit.md +40 -0
  45. md2site_cli-0.2.0/docs/prompts/PRD_v1.2.md +189 -0
  46. md2site_cli-0.2.0/docs/prompts/README.md +77 -0
  47. md2site_cli-0.2.0/docs/prompts/assets/md2site-overview.jpg +0 -0
  48. md2site_cli-0.2.0/docs/quickstart.md +43 -0
  49. md2site_cli-0.2.0/docs/search-and-mermaid.md +23 -0
  50. md2site_cli-0.2.0/docs/theming.md +22 -0
  51. md2site_cli-0.2.0/pyproject.toml +70 -0
  52. md2site_cli-0.2.0/src/md2site/__init__.py +7 -0
  53. md2site_cli-0.2.0/src/md2site/__main__.py +10 -0
  54. md2site_cli-0.2.0/src/md2site/assets.py +211 -0
  55. md2site_cli-0.2.0/src/md2site/build.py +152 -0
  56. md2site_cli-0.2.0/src/md2site/cli.py +354 -0
  57. md2site_cli-0.2.0/src/md2site/config.py +444 -0
  58. md2site_cli-0.2.0/src/md2site/diagnostics.py +167 -0
  59. md2site_cli-0.2.0/src/md2site/frontmatter.py +245 -0
  60. md2site_cli-0.2.0/src/md2site/hook.py +129 -0
  61. md2site_cli-0.2.0/src/md2site/init_cmd.py +153 -0
  62. md2site_cli-0.2.0/src/md2site/links.py +1403 -0
  63. md2site_cli-0.2.0/src/md2site/markdown.py +408 -0
  64. md2site_cli-0.2.0/src/md2site/model.py +80 -0
  65. md2site_cli-0.2.0/src/md2site/nav.py +286 -0
  66. md2site_cli-0.2.0/src/md2site/paths.py +130 -0
  67. md2site_cli-0.2.0/src/md2site/render.py +306 -0
  68. md2site_cli-0.2.0/src/md2site/scanner.py +273 -0
  69. md2site_cli-0.2.0/src/md2site/search.py +96 -0
  70. md2site_cli-0.2.0/src/md2site/server.py +267 -0
  71. md2site_cli-0.2.0/src/md2site/skill/SKILL.md +50 -0
  72. md2site_cli-0.2.0/src/md2site/slug.py +40 -0
  73. md2site_cli-0.2.0/src/md2site/static/css/md2site.css +974 -0
  74. md2site_cli-0.2.0/src/md2site/static/js/app.js +301 -0
  75. md2site_cli-0.2.0/src/md2site/static/js/mermaid-init.js +93 -0
  76. md2site_cli-0.2.0/src/md2site/static/js/search.js +577 -0
  77. md2site_cli-0.2.0/src/md2site/static/js/theme-init.js +24 -0
  78. md2site_cli-0.2.0/src/md2site/static/vendor/mermaid.min.js +4329 -0
  79. md2site_cli-0.2.0/src/md2site/templates/base.html +82 -0
  80. md2site_cli-0.2.0/src/md2site/templates/landing.html +30 -0
  81. md2site_cli-0.2.0/src/md2site/templates/page.html +13 -0
  82. md2site_cli-0.2.0/src/md2site/templates/partials/breadcrumbs.html +15 -0
  83. md2site_cli-0.2.0/src/md2site/templates/partials/nav.html +37 -0
  84. md2site_cli-0.2.0/src/md2site/templates/partials/prevnext.html +20 -0
  85. md2site_cli-0.2.0/src/md2site/templates/partials/toc.html +14 -0
  86. md2site_cli-0.2.0/src/md2site/titles.py +96 -0
  87. md2site_cli-0.2.0/src/md2site/watcher.py +447 -0
  88. md2site_cli-0.2.0/src/md2site/wikilinks.py +314 -0
  89. md2site_cli-0.2.0/tests/README.md +30 -0
  90. md2site_cli-0.2.0/tests/conftest.py +21 -0
  91. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/assets/logo.png +0 -0
  92. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/bad_fm.md +5 -0
  93. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/guide/README.md +1 -0
  94. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/guide/index.md +1 -0
  95. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/guide/setup.md +3 -0
  96. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/guide/shared.md +1 -0
  97. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/index.md +10 -0
  98. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/md2site.config.json +8 -0
  99. md2site_cli-0.2.0/tests/fixtures/site_broken/docs/shared.md +1 -0
  100. md2site_cli-0.2.0/tests/fixtures/site_broken/src/app.py +2 -0
  101. md2site_cli-0.2.0/tests/fixtures/site_full/assets/logo.png +0 -0
  102. md2site_cli-0.2.0/tests/fixtures/site_full/docs/01_guide/01_setup.md +25 -0
  103. md2site_cli-0.2.0/tests/fixtures/site_full/docs/01_guide/02_wikilinks.md +20 -0
  104. md2site_cli-0.2.0/tests/fixtures/site_full/docs/01_guide/data.json +4 -0
  105. md2site_cli-0.2.0/tests/fixtures/site_full/docs/01_guide/diagram.png +0 -0
  106. md2site_cli-0.2.0/tests/fixtures/site_full/docs/01_guide/index.md +38 -0
  107. md2site_cli-0.2.0/tests/fixtures/site_full/docs/02_legacy/README.md +5 -0
  108. md2site_cli-0.2.0/tests/fixtures/site_full/docs/02_legacy/caf/303/251 guide.md" +5 -0
  109. md2site_cli-0.2.0/tests/fixtures/site_full/docs/02_legacy/secret.md +8 -0
  110. md2site_cli-0.2.0/tests/fixtures/site_full/docs/02_legacy/wip.md +8 -0
  111. md2site_cli-0.2.0/tests/fixtures/site_full/docs/custom.css +4 -0
  112. md2site_cli-0.2.0/tests/fixtures/site_full/docs/index.md +31 -0
  113. md2site_cli-0.2.0/tests/fixtures/site_full/docs/md2site.config.json +13 -0
  114. md2site_cli-0.2.0/tests/fixtures/site_full/pyproject.toml +3 -0
  115. md2site_cli-0.2.0/tests/fixtures/site_full/src/server.py +7 -0
  116. md2site_cli-0.2.0/tests/golden/01_guide_01_setup.html +14 -0
  117. md2site_cli-0.2.0/tests/golden/01_guide_02_wikilinks.html +15 -0
  118. md2site_cli-0.2.0/tests/golden/01_guide_index.html +53 -0
  119. md2site_cli-0.2.0/tests/golden/02_legacy_cafe_guide.html +3 -0
  120. md2site_cli-0.2.0/tests/golden/02_legacy_index.html +3 -0
  121. md2site_cli-0.2.0/tests/golden/index.html +29 -0
  122. md2site_cli-0.2.0/tests/test_cli_build_init_check.py +170 -0
  123. md2site_cli-0.2.0/tests/test_cli_smoke.py +102 -0
  124. md2site_cli-0.2.0/tests/test_config.py +153 -0
  125. md2site_cli-0.2.0/tests/test_cross_platform.py +224 -0
  126. md2site_cli-0.2.0/tests/test_frontmatter.py +102 -0
  127. md2site_cli-0.2.0/tests/test_golden_and_determinism.py +127 -0
  128. md2site_cli-0.2.0/tests/test_links_and_diagnostics.py +1044 -0
  129. md2site_cli-0.2.0/tests/test_markdown.py +275 -0
  130. md2site_cli-0.2.0/tests/test_paths.py +70 -0
  131. md2site_cli-0.2.0/tests/test_perf.py +88 -0
  132. md2site_cli-0.2.0/tests/test_readme_and_docs.py +84 -0
  133. md2site_cli-0.2.0/tests/test_release_metadata.py +36 -0
  134. md2site_cli-0.2.0/tests/test_render.py +191 -0
  135. md2site_cli-0.2.0/tests/test_scanner_nav.py +212 -0
  136. md2site_cli-0.2.0/tests/test_search_mermaid_assets.py +347 -0
  137. md2site_cli-0.2.0/tests/test_server_and_watcher.py +163 -0
  138. md2site_cli-0.2.0/tests/test_site_crawl.py +244 -0
  139. md2site_cli-0.2.0/tests/test_skill_and_hook.py +140 -0
  140. md2site_cli-0.2.0/tests/test_slug.py +28 -0
  141. md2site_cli-0.2.0/tests/test_titles.py +57 -0
@@ -0,0 +1,4 @@
1
+ * text=auto eol=lf
2
+ *.jpg binary
3
+ *.png binary
4
+ *.min.js binary
@@ -0,0 +1,88 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+ name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, windows-latest, macos-latest]
20
+ python-version: ["3.11", "3.12", "3.13"]
21
+ steps:
22
+ - uses: actions/checkout@v7
23
+ - uses: actions/setup-python@v7
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+ cache: "pip"
27
+ - run: python -m pip install -e ".[dev]"
28
+ - run: ruff check .
29
+ - run: ruff format --check .
30
+ - run: pytest -q --cov=md2site --cov-report=term-missing
31
+
32
+ dogfood:
33
+ name: Dogfood docs build
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v7
37
+ - uses: actions/setup-python@v7
38
+ with:
39
+ python-version: "3.12"
40
+ cache: "pip"
41
+ - run: python -m pip install -e .
42
+ - run: md2site check docs --json
43
+ - run: md2site build docs --strict
44
+ - uses: actions/upload-artifact@v7
45
+ with:
46
+ name: dogfood-site
47
+ path: docs/_site
48
+
49
+ package:
50
+ name: Package & wheel smoke test
51
+ runs-on: ubuntu-latest
52
+ steps:
53
+ - uses: actions/checkout@v7
54
+ - uses: actions/setup-python@v7
55
+ with:
56
+ python-version: "3.12"
57
+ cache: "pip"
58
+ - run: python -m pip install build twine
59
+ - run: python -m build
60
+ - run: twine check dist/*
61
+ - name: Verify wheel and sdist contents and install in clean venv
62
+ shell: bash
63
+ run: |
64
+ python - <<'PY'
65
+ import glob
66
+ import tarfile
67
+ import zipfile
68
+
69
+ whl = glob.glob("dist/*.whl")[0]
70
+ tgz = glob.glob("dist/*.tar.gz")[0]
71
+ with zipfile.ZipFile(whl) as z:
72
+ names = z.namelist()
73
+ assert any(n.endswith("licenses/LICENSE") for n in names), names
74
+ assert any(n.endswith("licenses/THIRD_PARTY_LICENSES.md") for n in names), names
75
+ with tarfile.open(tgz) as t:
76
+ names = t.getnames()
77
+ assert any(n.endswith("/THIRD_PARTY_LICENSES.md") for n in names), names
78
+ assert any("/tests/fixtures/" in n for n in names), names
79
+ PY
80
+ python -m venv /tmp/smoke-venv
81
+ /tmp/smoke-venv/bin/pip install dist/*.whl
82
+ /tmp/smoke-venv/bin/md2site --version
83
+ mkdir -p /tmp/smoke-docs
84
+ printf '# Smoke Test\n\n```mermaid\nflowchart LR\n A --> B\n```\n' > /tmp/smoke-docs/index.md
85
+ /tmp/smoke-venv/bin/md2site build /tmp/smoke-docs --strict
86
+ test -f /tmp/smoke-docs/_site/index.html
87
+ test -f /tmp/smoke-docs/_site/assets/md2site.css
88
+ test -f /tmp/smoke-docs/_site/assets/vendor/mermaid.min.js
@@ -0,0 +1,47 @@
1
+ name: Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "src/**"
9
+ - ".github/workflows/pages.yml"
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+ pages: write
15
+ id-token: write
16
+
17
+ concurrency:
18
+ group: "pages"
19
+ cancel-in-progress: false
20
+
21
+ jobs:
22
+ build:
23
+ if: vars.ENABLE_PAGES == 'true' || github.event_name == 'workflow_dispatch'
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+ - uses: actions/setup-python@v7
28
+ with:
29
+ python-version: "3.12"
30
+ cache: "pip"
31
+ - run: python -m pip install .
32
+ - run: md2site build docs --mode remote --strict
33
+ - uses: actions/configure-pages@v6
34
+ - uses: actions/upload-pages-artifact@v5
35
+ with:
36
+ path: docs/_site
37
+
38
+ deploy:
39
+ needs: build
40
+ if: needs.build.result == 'success'
41
+ runs-on: ubuntu-latest
42
+ environment:
43
+ name: github-pages
44
+ url: ${{ steps.deployment.outputs.page_url }}
45
+ steps:
46
+ - id: deployment
47
+ uses: actions/deploy-pages@v5
@@ -0,0 +1,98 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ name: Build & verify distributions
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ contents: read
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ - uses: actions/setup-python@v7
20
+ with:
21
+ python-version: "3.12"
22
+ cache: "pip"
23
+ - name: Verify tag matches package version
24
+ shell: bash
25
+ run: |
26
+ python - <<'PY'
27
+ import os
28
+ import sys
29
+ sys.path.insert(0, "src")
30
+ from md2site import __version__
31
+
32
+ tag = os.environ["GITHUB_REF_NAME"]
33
+ expected = f"v{__version__}"
34
+ assert tag == expected, f"Tag {tag!r} does not match package version {expected!r}"
35
+ print(f"Verified tag {tag} == {expected}")
36
+ PY
37
+ - run: python -m pip install build twine
38
+ - run: python -m build
39
+ - run: twine check dist/*
40
+ - uses: actions/upload-artifact@v7
41
+ with:
42
+ name: dist
43
+ path: dist/
44
+
45
+ github-release:
46
+ name: Create GitHub Release
47
+ needs: build
48
+ runs-on: ubuntu-latest
49
+ permissions:
50
+ contents: write
51
+ steps:
52
+ - uses: actions/checkout@v7
53
+ - uses: actions/download-artifact@v8
54
+ with:
55
+ name: dist
56
+ path: dist
57
+ - name: Extract changelog notes
58
+ shell: bash
59
+ run: |
60
+ python - <<'PY'
61
+ import os
62
+ import re
63
+ from pathlib import Path
64
+
65
+ version = os.environ["GITHUB_REF_NAME"].lstrip("v")
66
+ text = Path("CHANGELOG.md").read_text(encoding="utf-8")
67
+ pattern = re.compile(
68
+ rf"^## \[{re.escape(version)}\][^\n]*\n(.*?)(?=^## \[|\Z)",
69
+ re.MULTILINE | re.DOTALL,
70
+ )
71
+ m = pattern.search(text)
72
+ notes = m.group(1).strip() if m else f"Release {os.environ['GITHUB_REF_NAME']}"
73
+ Path("/tmp/release-notes.md").write_text(notes + "\n", encoding="utf-8")
74
+ PY
75
+ - name: Publish GitHub Release
76
+ env:
77
+ GH_TOKEN: ${{ github.token }}
78
+ run: |
79
+ gh release create "${{ github.ref_name }}" dist/* \
80
+ --title "md2site ${{ github.ref_name }}" \
81
+ --notes-file /tmp/release-notes.md
82
+
83
+ pypi:
84
+ name: Publish to PyPI
85
+ needs: build
86
+ if: vars.PUBLISH_TO_PYPI == 'true'
87
+ runs-on: ubuntu-latest
88
+ environment:
89
+ name: pypi
90
+ url: https://pypi.org/p/md2site-cli
91
+ permissions:
92
+ id-token: write
93
+ steps:
94
+ - uses: actions/download-artifact@v8
95
+ with:
96
+ name: dist
97
+ path: dist
98
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,32 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ ENV/
16
+ env/
17
+
18
+ # Test / lint caches
19
+ .pytest_cache/
20
+ .ruff_cache/
21
+ .coverage
22
+ htmlcov/
23
+
24
+ # Generated docs output
25
+ _site/
26
+
27
+ # Editors / OS
28
+ .vscode/
29
+ .idea/
30
+ *.swp
31
+ *.swo
32
+ .DS_Store
@@ -0,0 +1,71 @@
1
+ ## Standing rules (these become `AGENTS.md` in the repo)
2
+
3
+ 1. **Read the PRD sections named in your prompt before coding.** Build only what the current prompt asks. Park anything else in `docs/TODO.md`.
4
+ 2. **Principles (PRD §4) are hard constraints:** works from `file://` (no `fetch` of local files, no ES modules, no root-absolute URLs, no `<base>`, never link to a bare directory); zero runtime network (vendored JS, system fonts); deterministic output; never silently drop a reference; small dependency tree.
5
+ 3. **Allowed runtime dependencies:** `markdown-it-py`, `mdit-py-plugins`, `pygments`, `jinja2`, `watchdog`. CLI is stdlib `argparse`. Anything else needs a one-line justification in `docs/decisions.md` first. Dev extras: `pytest`, `ruff`, `build`.
6
+ 4. **Code style:** Python ≥ 3.11, `from __future__ import annotations`, full type hints, `pathlib` for filesystem paths, `PurePosixPath` for URLs, dataclasses for data, no module-level mutable state, no `print()` in library code (return data / use the diagnostics collector; only `cli.py` writes to the terminal). `ruff check` and `ruff format --check` must pass.
7
+ 5. **Determinism:** sort every directory listing and every dict you iterate for output. No timestamps, random ids, or absolute paths in generated HTML.
8
+ 6. **Tests ship with the code.** Every prompt adds or extends pytest tests. Run `pytest -q` and `ruff check .` before every commit. Do not commit with failing tests.
9
+ 7. **Git:** Conventional Commits (`feat:`, `fix:`, `test:`, `docs:`, `chore:`), one logical commit at a time, push to `origin main` after each prompt completes. Never force-push. Never commit `_site/`, `.venv/`, or build artifacts.
10
+ 8. **Ambiguity rule:** pick the simplest behaviour that satisfies the Principles, add a one-line entry to `docs/decisions.md` (`date · decision · why`), and continue. Only stop and ask if you are fully blocked.
11
+ 9. **Windows/macOS/Linux:** never build URLs with `os.path.join`; use `Path.as_posix()` / `PurePosixPath`; compare paths case-sensitively on purpose and emit `MD2S006` for mismatches.
12
+ 10. **End every prompt with a report:** what you built, files touched, test + lint results, deviations from the prompt/PRD (with reasons), open questions, and the exact commit hashes pushed.
13
+
14
+ ## Repository layout (target)
15
+
16
+ ```
17
+ md2site/
18
+ ├─ pyproject.toml README.md LICENSE CHANGELOG.md AGENTS.md
19
+ ├─ .github/workflows/ci.yml
20
+ ├─ docs/ # dogfood: md2site documents itself; built with md2site
21
+ │ ├─ index.md PRD.md decisions.md TODO.md …
22
+ │ └─ assets/md2site-overview.jpg
23
+ ├─ src/md2site/
24
+ │ ├─ __init__.py __main__.py cli.py
25
+ │ ├─ config.py model.py paths.py frontmatter.py titles.py slug.py
26
+ │ ├─ scanner.py nav.py
27
+ │ ├─ markdown.py # engine, alerts, fences, headings, text extraction
28
+ │ ├─ links.py wikilinks.py diagnostics.py
29
+ │ ├─ render.py search.py assets.py build.py
30
+ │ ├─ init_cmd.py server.py watcher.py hook.py
31
+ │ ├─ templates/ # jinja2: base.html page.html partials/*.html
32
+ │ ├─ static/ # css/ js/ vendor/mermaid.min.js
33
+ │ └─ skill/SKILL.md
34
+ └─ tests/ (fixtures/, golden/, unit tests, test_perf.py, test_site_crawl.py)
35
+ ```
36
+
37
+ ## Shared data model (keep names consistent across prompts)
38
+
39
+ ```python
40
+ @dataclass(frozen=True)
41
+ class Heading: level: int; text: str; id: str
42
+
43
+ @dataclass
44
+ class Page:
45
+ src: Path # absolute source path
46
+ rel: PurePosixPath # path relative to docs_dir, e.g. guide/setup.md
47
+ out_rel: PurePosixPath # e.g. guide/setup.html (index pages -> .../index.html)
48
+ title: str; order: float | None; hidden: bool; draft: bool
49
+ aliases: tuple[str, ...]; tags: tuple[str, ...]
50
+ meta: dict # raw front matter
51
+ headings: list[Heading] # filled after parse
52
+ tokens: list # markdown-it tokens (rewritten by links.py before render)
53
+ text: str # plain text for search
54
+
55
+ @dataclass
56
+ class NavNode: label: str; page: Page | None; children: list["NavNode"]; is_dir: bool
57
+
58
+ @dataclass(frozen=True)
59
+ class Diagnostic: level: str; code: str; file: str; line: int | None
60
+ message: str; target: str | None = None; suggestion: str | None = None
61
+
62
+ @dataclass
63
+ class Site: config: Config; pages: list[Page]; nav: list[NavNode]
64
+ by_rel: dict; assets: list["AssetCopy"]; diagnostics: list[Diagnostic]
65
+ ```
66
+
67
+ ## Pipeline (two-pass; do not collapse it)
68
+
69
+ `scan → parse (tokens + headings, no link rewriting) → index (titles, aliases, heading ids, wikilink table) → resolve (rewrite links in tokens, collect assets + diagnostics) → render (jinja) → emit (hash-skip unchanged files)`
70
+
71
+ `check` runs everything up to and including *resolve*; `build` runs all stages; `watch` re-runs the minimum necessary.
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] - 2026-12-05
9
+
10
+ ### Added
11
+
12
+ - Optional explicit `"nav"` ordering and hierarchy override in `md2site.config.json` (leaf paths, `"dir/"` auto-expansion sections, custom labels, grouped sections, and `MD2S001` diagnostics for missing nav targets; unlisted pages stay built and searchable).
13
+ - Exact 1-based inline source line numbers for diagnostics (`MD2S001`–`MD2S007`, `MD2S010`, `MD2S011`) across multi-line paragraphs, lists, GFM tables, GitHub callouts, and YAML front-matter offsets.
14
+ - Code highlighting size bound (`max_highlight_bytes`, default `262144` / 256 KiB, `0` disables) with clean `<pre><code>` fallback on oversized fences.
15
+ - Optional deterministic search index byte budget (`search.max_index_bytes`, default `0` unlimited) that trims page body snippets fairly before headings/entries.
16
+ - Diagnostic `MD2S011` and graceful fallback when `output_dir` / `--out` cannot reach `repo_root` across drives/filesystems (preferring `remote_repo_url` when set, otherwise `file:///` URI with once-per-build `MD2S011`).
17
+
18
+ ### Fixed
19
+
20
+ - Preserved `?query` parameters (while keeping percent-encoded literal `?` filenames like `why%3F.md`) across local `.md` links, doc assets, images, and `repo_file` links (`relative`, `remote`, `auto`).
21
+ - Optimized block-level map shifting, linkless inline-token traversal, and large fence rendering (~33x speedup on 1 MB JSON fences; ~39% faster on 5 MB prose pages).
22
+ - Atomic output file writes (`write_if_changed` via sibling temp file + `os.replace`) so interrupted or concurrent builds never leave half-written HTML/CSS/JS files.
23
+
24
+ ### Known Limitations
25
+
26
+ - The client-side `assets/search-index.js` index scales linearly unless bounded with `search.max_index_bytes`.
27
+ - `source_link_mode: "relative"` on cross-machine deployments assumes `_site/` stays inside the repository checkout (use `--mode remote` when hosting externally).
28
+ - No third-party plugin system (intentional non-goal).
29
+
30
+ ## [0.1.0] - 2026-12-05
31
+
32
+ ### Added
33
+
34
+ - Zero-config Markdown-to-HTML static site compiler (`md2site build`, `md2site watch`, `md2site check`, `md2site init`, `md2site hook`).
35
+ - Works cleanly from `file://` as well as HTTP hosts (`relative` URLs everywhere, no `fetch()`, no ES modules, no `<base>`, explicit `index.html` targets, system fonts only).
36
+ - Two-pass build pipeline (`scan -> parse -> index -> resolve -> render -> emit`) with SHA-256 hash-skipping incremental writes and deterministic output.
37
+ - Full-fidelity GFM rendering via `markdown-it-py`: tables, task lists, footnotes, GitHub alerts (`[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, `[!CAUTION]`), heading anchors, build-time Pygments syntax highlighting with copy buttons, and front matter (`---` / `+++`).
38
+ - Intelligent link and reference resolution: relative and root-relative `.md` links, directory `index.md`/`README.md` resolution, `[[Wikilinks]]` and `![[embeds]]` with nearest-match tie-breaking, heading `#anchor` validation, case-mismatch detection (`MD2S006`), repo source-file linking (`relative`, `editor`, `remote`, `auto`), and opt-in inline-code path autolinking.
39
+ - Structured compiler diagnostics (`MD2S001`–`MD2S010`) with machine-readable `md2site check --json` and `--strict` gate.
40
+ - Responsive reader UI with flicker-free light/dark toggle, configurable CSS tokens, reading-time metadata, collapsible mobile navigation drawer, right-hand TOC spy, prev/next links, and print stylesheet.
41
+ - Offline client-side search (`Ctrl`/`Cmd+K`) powered by `assets/search-index.js` loaded lazily on demand, with vendored offline Mermaid (`mermaid@12.3.0`) included only on pages containing diagrams.
42
+ - Agent integration: `md2site init --with-skill` (`SKILL.md`), `md2site hook` post-edit stdin validator, `md2site check --json`, and live-reloading `md2site watch` server with SSE.
43
+ - Dogfooded project documentation under `docs/` and automated CI/release/Pages workflows.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Folajimi Joshua Olabode
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.