markdotserver 0.1.0__tar.gz → 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 (30) hide show
  1. {markdotserver-0.1.0/src/markdotserver.egg-info → markdotserver-0.2.0}/PKG-INFO +61 -37
  2. {markdotserver-0.1.0 → markdotserver-0.2.0}/README.md +54 -35
  3. {markdotserver-0.1.0 → markdotserver-0.2.0}/pyproject.toml +10 -2
  4. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/__init__.py +1 -1
  5. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/filesystem.py +2 -2
  6. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/markdown_renderer.py +0 -1
  7. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/routes.py +32 -2
  8. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/static/css/app.css +0 -11
  9. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/templates/index.html +0 -3
  10. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/templates/partials/toolbar.html +2 -6
  11. {markdotserver-0.1.0 → markdotserver-0.2.0/src/markdotserver.egg-info}/PKG-INFO +61 -37
  12. {markdotserver-0.1.0 → markdotserver-0.2.0}/LICENSE +0 -0
  13. {markdotserver-0.1.0 → markdotserver-0.2.0}/setup.cfg +0 -0
  14. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/__main__.py +0 -0
  15. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/app.py +0 -0
  16. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/config.py +0 -0
  17. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/graphviz_renderer.py +0 -0
  18. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/py.typed +0 -0
  19. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/static/js/app.js +0 -0
  20. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/static/js/theme.js +0 -0
  21. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/templates/base.html +0 -0
  22. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/templates/partials/directory_tree.html +0 -0
  23. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/templates/partials/document.html +0 -0
  24. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/templates/partials/error.html +0 -0
  25. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver/templates/partials/headings.html +0 -0
  26. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver.egg-info/SOURCES.txt +0 -0
  27. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver.egg-info/dependency_links.txt +0 -0
  28. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver.egg-info/entry_points.txt +0 -0
  29. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver.egg-info/requires.txt +0 -0
  30. {markdotserver-0.1.0 → markdotserver-0.2.0}/src/markdotserver.egg-info/top_level.txt +0 -0
@@ -1,18 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdotserver
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Lightweight, read-only HTTP viewer for Markdown and Graphviz documentation
5
5
  Author-email: Alexey Agafonov <128855676+lucir13@users.noreply.github.com>
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/lucir13/markdotserver
8
8
  Project-URL: Repository, https://github.com/lucir13/markdotserver
9
9
  Project-URL: Issues, https://github.com/lucir13/markdotserver/issues
10
+ Project-URL: Changelog, https://github.com/lucir13/markdotserver/blob/main/CHANGELOG.md
10
11
  Keywords: markdown,graphviz,documentation,viewer,dot,svg
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
11
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
12
17
  Classifier: Programming Language :: Python :: 3 :: Only
13
18
  Classifier: Topic :: Documentation
14
19
  Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
15
- Classifier: Intended Audience :: Developers
20
+ Classifier: Typing :: Typed
16
21
  Requires-Python: >=3.12
17
22
  Description-Content-Type: text/markdown
18
23
  License-File: LICENSE
@@ -35,7 +40,8 @@ step, database or generated site, and the server never modifies the documentatio
35
40
  directory.
36
41
 
37
42
  [![CI](https://github.com/lucir13/markdotserver/actions/workflows/ci.yml/badge.svg)](https://github.com/lucir13/markdotserver/actions/workflows/ci.yml)
38
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
43
+ [![PyPI](https://img.shields.io/pypi/v/markdotserver.svg)](https://pypi.org/project/markdotserver/)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/lucir13/markdotserver/blob/main/LICENSE)
39
45
 
40
46
  ## Features
41
47
 
@@ -60,11 +66,10 @@ directory.
60
66
  - Bounded caching for the directory tree and rendered diagrams, and a dedicated
61
67
  worker pool so slow documents cannot stall the rest of the server.
62
68
 
63
- ## Requirements
69
+ ## Install
64
70
 
65
- - Python 3.12 or newer
66
- - Graphviz with the `dot` executable on `PATH`
67
- - A modern browser
71
+ `markdotserver` requires Python 3.12 or newer, Graphviz with the `dot` executable on
72
+ `PATH`, and a modern browser.
68
73
 
69
74
  Install Graphviz first, for example:
70
75
 
@@ -81,27 +86,31 @@ brew install graphviz
81
86
 
82
87
  Verify it with `dot -V`.
83
88
 
84
- ## Quick start
89
+ Then install the viewer from PyPI:
85
90
 
86
- From the repository root:
91
+ ```bash
92
+ python -m pip install markdotserver
93
+ ```
94
+
95
+ Verify the installation:
87
96
 
88
97
  ```bash
89
- python3.12 -m venv .venv
90
- source .venv/bin/activate
91
- python -m pip install --upgrade pip
92
- python -m pip install -e .
93
- python -m markdotserver --root examples --port 8765
98
+ markdotserver --version
94
99
  ```
95
100
 
96
- Open <http://127.0.0.1:8765/>. The server redirects to `examples/README.md`.
101
+ ## Quick start
97
102
 
98
- To serve your own documentation:
103
+ Point the server at an existing documentation directory:
99
104
 
100
105
  ```bash
101
- python -m markdotserver --root /path/to/docs
106
+ markdotserver --root /path/to/docs
102
107
  ```
103
108
 
104
- Useful options:
109
+ Open <http://127.0.0.1:8000/>. The root must already exist and be readable. If it
110
+ contains `README.md`, `readme.md`, `index.md` or `INDEX.md`, `/` redirects to that
111
+ document; otherwise a welcome page is shown.
112
+
113
+ ## Command-line options
105
114
 
106
115
  ```text
107
116
  --root DIRECTORY documentation root (default: current directory)
@@ -121,9 +130,19 @@ Useful options:
121
130
  --version print the version
122
131
  ```
123
132
 
124
- The root must already exist and be readable. If it contains `README.md`,
125
- `readme.md`, `index.md` or `INDEX.md`, `/` redirects to that document; otherwise a
126
- welcome page is shown.
133
+ ## From a source checkout
134
+
135
+ From the repository root:
136
+
137
+ ```bash
138
+ python3.12 -m venv .venv
139
+ source .venv/bin/activate
140
+ python -m pip install --upgrade pip
141
+ python -m pip install -e .
142
+ python -m markdotserver --root examples --port 8765
143
+ ```
144
+
145
+ Open <http://127.0.0.1:8765/>. The server redirects to `examples/README.md`.
127
146
 
128
147
  ## Supported formats
129
148
 
@@ -165,7 +184,7 @@ Keep the default loopback bind and forward the port over SSH:
165
184
 
166
185
  ```bash
167
186
  # On the server
168
- python -m markdotserver --root /srv/docs --port 8765
187
+ markdotserver --root /srv/docs --port 8765
169
188
 
170
189
  # On the client
171
190
  ssh -L 8765:127.0.0.1:8765 user@server.example.com
@@ -193,7 +212,8 @@ Then open <http://127.0.0.1:8765/> locally.
193
212
  networks.
194
213
 
195
214
  **Graphviz is not a sandbox.** DOT files must be trusted; malicious graphs can still
196
- consume resources or exploit Graphviz bugs. See [Security](docs/security.md).
215
+ consume resources or exploit Graphviz bugs. See
216
+ [Security](https://github.com/lucir13/markdotserver/blob/main/docs/security.md).
197
217
 
198
218
  ## Testing
199
219
 
@@ -217,27 +237,31 @@ manually against `examples/`.
217
237
 
218
238
  ## Documentation
219
239
 
220
- - [Documentation index](docs/index.md)
221
- - [Installation](docs/installation.md)
222
- - [Usage](docs/usage.md)
223
- - [Supported formats](docs/formats.md)
224
- - [Architecture](docs/architecture.md)
225
- - [Security](docs/security.md)
226
- - [Testing](docs/testing.md)
227
- - [Limitations](docs/limitations.md)
228
- - [Detailed design](docs/design.md)
229
- - [Security policy](SECURITY.md)
230
- - [Third-party notices](THIRD_PARTY_NOTICES.md)
240
+ - [Documentation index](https://github.com/lucir13/markdotserver/blob/main/docs/index.md)
241
+ - [Installation](https://github.com/lucir13/markdotserver/blob/main/docs/installation.md)
242
+ - [Usage](https://github.com/lucir13/markdotserver/blob/main/docs/usage.md)
243
+ - [Supported formats](https://github.com/lucir13/markdotserver/blob/main/docs/formats.md)
244
+ - [Architecture](https://github.com/lucir13/markdotserver/blob/main/docs/architecture.md)
245
+ - [Security](https://github.com/lucir13/markdotserver/blob/main/docs/security.md)
246
+ - [Testing](https://github.com/lucir13/markdotserver/blob/main/docs/testing.md)
247
+ - [Limitations](https://github.com/lucir13/markdotserver/blob/main/docs/limitations.md)
248
+ - [Detailed design](https://github.com/lucir13/markdotserver/blob/main/docs/design.md)
249
+ - [Changelog](https://github.com/lucir13/markdotserver/blob/main/CHANGELOG.md)
250
+ - [Security policy](https://github.com/lucir13/markdotserver/blob/main/SECURITY.md)
251
+ - [Third-party notices](https://github.com/lucir13/markdotserver/blob/main/THIRD_PARTY_NOTICES.md)
231
252
 
232
253
  ## Project status
233
254
 
234
255
  The project is feature-complete: package scaffolding, configuration and path
235
256
  confinement, Graphviz and Markdown rendering, the HTTP interface, the two-pane
236
257
  interface, the example tree, complete documentation, hardening and acceptance
237
- verification are all in place. See the [detailed design](docs/design.md) for the
238
- architecture and implementation decisions.
258
+ verification are all in place. Releases are published on
259
+ [PyPI](https://pypi.org/project/markdotserver/). See the
260
+ [detailed design](https://github.com/lucir13/markdotserver/blob/main/docs/design.md)
261
+ for the architecture and implementation decisions.
239
262
 
240
263
  ## Licence
241
264
 
242
- MIT. See [LICENSE](LICENSE). Reuse and redistribution are permitted provided the
265
+ MIT. See [LICENSE](https://github.com/lucir13/markdotserver/blob/main/LICENSE). Reuse
266
+ and redistribution are permitted provided the
243
267
  copyright notice and permission notice in that file are retained with the software.
@@ -8,7 +8,8 @@ step, database or generated site, and the server never modifies the documentatio
8
8
  directory.
9
9
 
10
10
  [![CI](https://github.com/lucir13/markdotserver/actions/workflows/ci.yml/badge.svg)](https://github.com/lucir13/markdotserver/actions/workflows/ci.yml)
11
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
11
+ [![PyPI](https://img.shields.io/pypi/v/markdotserver.svg)](https://pypi.org/project/markdotserver/)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/lucir13/markdotserver/blob/main/LICENSE)
12
13
 
13
14
  ## Features
14
15
 
@@ -33,11 +34,10 @@ directory.
33
34
  - Bounded caching for the directory tree and rendered diagrams, and a dedicated
34
35
  worker pool so slow documents cannot stall the rest of the server.
35
36
 
36
- ## Requirements
37
+ ## Install
37
38
 
38
- - Python 3.12 or newer
39
- - Graphviz with the `dot` executable on `PATH`
40
- - A modern browser
39
+ `markdotserver` requires Python 3.12 or newer, Graphviz with the `dot` executable on
40
+ `PATH`, and a modern browser.
41
41
 
42
42
  Install Graphviz first, for example:
43
43
 
@@ -54,27 +54,31 @@ brew install graphviz
54
54
 
55
55
  Verify it with `dot -V`.
56
56
 
57
- ## Quick start
57
+ Then install the viewer from PyPI:
58
58
 
59
- From the repository root:
59
+ ```bash
60
+ python -m pip install markdotserver
61
+ ```
62
+
63
+ Verify the installation:
60
64
 
61
65
  ```bash
62
- python3.12 -m venv .venv
63
- source .venv/bin/activate
64
- python -m pip install --upgrade pip
65
- python -m pip install -e .
66
- python -m markdotserver --root examples --port 8765
66
+ markdotserver --version
67
67
  ```
68
68
 
69
- Open <http://127.0.0.1:8765/>. The server redirects to `examples/README.md`.
69
+ ## Quick start
70
70
 
71
- To serve your own documentation:
71
+ Point the server at an existing documentation directory:
72
72
 
73
73
  ```bash
74
- python -m markdotserver --root /path/to/docs
74
+ markdotserver --root /path/to/docs
75
75
  ```
76
76
 
77
- Useful options:
77
+ Open <http://127.0.0.1:8000/>. The root must already exist and be readable. If it
78
+ contains `README.md`, `readme.md`, `index.md` or `INDEX.md`, `/` redirects to that
79
+ document; otherwise a welcome page is shown.
80
+
81
+ ## Command-line options
78
82
 
79
83
  ```text
80
84
  --root DIRECTORY documentation root (default: current directory)
@@ -94,9 +98,19 @@ Useful options:
94
98
  --version print the version
95
99
  ```
96
100
 
97
- The root must already exist and be readable. If it contains `README.md`,
98
- `readme.md`, `index.md` or `INDEX.md`, `/` redirects to that document; otherwise a
99
- welcome page is shown.
101
+ ## From a source checkout
102
+
103
+ From the repository root:
104
+
105
+ ```bash
106
+ python3.12 -m venv .venv
107
+ source .venv/bin/activate
108
+ python -m pip install --upgrade pip
109
+ python -m pip install -e .
110
+ python -m markdotserver --root examples --port 8765
111
+ ```
112
+
113
+ Open <http://127.0.0.1:8765/>. The server redirects to `examples/README.md`.
100
114
 
101
115
  ## Supported formats
102
116
 
@@ -138,7 +152,7 @@ Keep the default loopback bind and forward the port over SSH:
138
152
 
139
153
  ```bash
140
154
  # On the server
141
- python -m markdotserver --root /srv/docs --port 8765
155
+ markdotserver --root /srv/docs --port 8765
142
156
 
143
157
  # On the client
144
158
  ssh -L 8765:127.0.0.1:8765 user@server.example.com
@@ -166,7 +180,8 @@ Then open <http://127.0.0.1:8765/> locally.
166
180
  networks.
167
181
 
168
182
  **Graphviz is not a sandbox.** DOT files must be trusted; malicious graphs can still
169
- consume resources or exploit Graphviz bugs. See [Security](docs/security.md).
183
+ consume resources or exploit Graphviz bugs. See
184
+ [Security](https://github.com/lucir13/markdotserver/blob/main/docs/security.md).
170
185
 
171
186
  ## Testing
172
187
 
@@ -190,27 +205,31 @@ manually against `examples/`.
190
205
 
191
206
  ## Documentation
192
207
 
193
- - [Documentation index](docs/index.md)
194
- - [Installation](docs/installation.md)
195
- - [Usage](docs/usage.md)
196
- - [Supported formats](docs/formats.md)
197
- - [Architecture](docs/architecture.md)
198
- - [Security](docs/security.md)
199
- - [Testing](docs/testing.md)
200
- - [Limitations](docs/limitations.md)
201
- - [Detailed design](docs/design.md)
202
- - [Security policy](SECURITY.md)
203
- - [Third-party notices](THIRD_PARTY_NOTICES.md)
208
+ - [Documentation index](https://github.com/lucir13/markdotserver/blob/main/docs/index.md)
209
+ - [Installation](https://github.com/lucir13/markdotserver/blob/main/docs/installation.md)
210
+ - [Usage](https://github.com/lucir13/markdotserver/blob/main/docs/usage.md)
211
+ - [Supported formats](https://github.com/lucir13/markdotserver/blob/main/docs/formats.md)
212
+ - [Architecture](https://github.com/lucir13/markdotserver/blob/main/docs/architecture.md)
213
+ - [Security](https://github.com/lucir13/markdotserver/blob/main/docs/security.md)
214
+ - [Testing](https://github.com/lucir13/markdotserver/blob/main/docs/testing.md)
215
+ - [Limitations](https://github.com/lucir13/markdotserver/blob/main/docs/limitations.md)
216
+ - [Detailed design](https://github.com/lucir13/markdotserver/blob/main/docs/design.md)
217
+ - [Changelog](https://github.com/lucir13/markdotserver/blob/main/CHANGELOG.md)
218
+ - [Security policy](https://github.com/lucir13/markdotserver/blob/main/SECURITY.md)
219
+ - [Third-party notices](https://github.com/lucir13/markdotserver/blob/main/THIRD_PARTY_NOTICES.md)
204
220
 
205
221
  ## Project status
206
222
 
207
223
  The project is feature-complete: package scaffolding, configuration and path
208
224
  confinement, Graphviz and Markdown rendering, the HTTP interface, the two-pane
209
225
  interface, the example tree, complete documentation, hardening and acceptance
210
- verification are all in place. See the [detailed design](docs/design.md) for the
211
- architecture and implementation decisions.
226
+ verification are all in place. Releases are published on
227
+ [PyPI](https://pypi.org/project/markdotserver/). See the
228
+ [detailed design](https://github.com/lucir13/markdotserver/blob/main/docs/design.md)
229
+ for the architecture and implementation decisions.
212
230
 
213
231
  ## Licence
214
232
 
215
- MIT. See [LICENSE](LICENSE). Reuse and redistribution are permitted provided the
233
+ MIT. See [LICENSE](https://github.com/lucir13/markdotserver/blob/main/LICENSE). Reuse
234
+ and redistribution are permitted provided the
216
235
  copyright notice and permission notice in that file are retained with the software.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "markdotserver"
7
- version = "0.1.0"
7
+ dynamic = ["version"]
8
8
  description = "Lightweight, read-only HTTP viewer for Markdown and Graphviz documentation"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -15,11 +15,15 @@ authors = [
15
15
  ]
16
16
  keywords = ["markdown", "graphviz", "documentation", "viewer", "dot", "svg"]
17
17
  classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Environment :: Console",
20
+ "Intended Audience :: Developers",
18
21
  "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
19
23
  "Programming Language :: Python :: 3 :: Only",
20
24
  "Topic :: Documentation",
21
25
  "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
22
- "Intended Audience :: Developers",
26
+ "Typing :: Typed",
23
27
  ]
24
28
  # Lower bounds are the oldest releases the implementation is verified against.
25
29
  # They are deliberately permissive so embedders can resolve markdotserver
@@ -43,6 +47,7 @@ markdotserver = "markdotserver.__main__:main"
43
47
  Homepage = "https://github.com/lucir13/markdotserver"
44
48
  Repository = "https://github.com/lucir13/markdotserver"
45
49
  Issues = "https://github.com/lucir13/markdotserver/issues"
50
+ Changelog = "https://github.com/lucir13/markdotserver/blob/main/CHANGELOG.md"
46
51
 
47
52
  [dependency-groups]
48
53
  # Starlette 1.x imports httpx2 for its TestClient and falls back to httpx, so
@@ -58,6 +63,9 @@ dev = [
58
63
  "types-Pygments>=2.17",
59
64
  ]
60
65
 
66
+ [tool.setuptools.dynamic]
67
+ version = { attr = "markdotserver.__version__" }
68
+
61
69
  [tool.setuptools.packages.find]
62
70
  where = ["src"]
63
71
 
@@ -2,6 +2,6 @@
2
2
  # SPDX-License-Identifier: MIT
3
3
  """markdotserver: a lightweight, read-only documentation viewer."""
4
4
 
5
- __version__ = "0.1.0"
5
+ __version__ = "0.2.0"
6
6
 
7
7
  __all__ = ["__version__"]
@@ -339,8 +339,8 @@ class Filesystem:
339
339
  """Return the complete visible tree below the root.
340
340
 
341
341
  The result is cached for ``tree_cache_ttl`` seconds because rebuilding it
342
- stats every visible file. Pass ``fresh=True`` to force a rescan, which is
343
- what the interface's Refresh control does.
342
+ stats every visible file. Pass ``fresh=True`` to force a rescan, or call
343
+ :meth:`invalidate_tree_cache` to make the next normal build rescan.
344
344
  """
345
345
  with self._tree_lock:
346
346
  cached = self._tree_cache
@@ -137,7 +137,6 @@ _RESERVED_HEADING_IDS = frozenset(
137
137
  "tab-headings",
138
138
  "theme-toggle",
139
139
  "toolbar",
140
- "tree-refresh",
141
140
  }
142
141
  )
143
142
 
@@ -491,6 +491,35 @@ async def home(request: Request) -> Response:
491
491
  return _page(request, context)
492
492
 
493
493
 
494
+ async def _reload_redirect(request: Request, path: str, mode: str) -> Response:
495
+ """Drop the cached tree and send the client back to a normal page load.
496
+
497
+ A full navigation is deliberate: it refreshes the document, toolbar,
498
+ headings and tree together and works without JavaScript.
499
+ """
500
+ if mode not in ("rendered", "source"):
501
+ raise HTTPException(status_code=400, detail=f"invalid view mode: {mode}")
502
+
503
+ await asyncio.to_thread(request.app.state.filesystem.invalidate_tree_cache)
504
+
505
+ target = f"/view/{encode_path(path)}" if path else "/"
506
+ if path and mode == "source":
507
+ target += "?mode=source"
508
+ return RedirectResponse(target, status_code=303, headers=dict(_DYNAMIC_HEADERS))
509
+
510
+
511
+ @router.api_route("/reload", methods=["GET", "HEAD"])
512
+ async def reload_home(request: Request) -> Response:
513
+ """Reload the welcome page with a freshly scanned directory tree."""
514
+ return await _reload_redirect(request, "", "rendered")
515
+
516
+
517
+ @router.api_route("/reload/{path:path}", methods=["GET", "HEAD"])
518
+ async def reload_view(request: Request, path: str, mode: str = "rendered") -> Response:
519
+ """Reload a document with a freshly scanned directory tree."""
520
+ return await _reload_redirect(request, path, mode)
521
+
522
+
494
523
  @router.api_route(
495
524
  "/view/{path:path}", methods=["GET", "HEAD"], response_class=HTMLResponse
496
525
  )
@@ -525,8 +554,9 @@ async def tree_json(request: Request) -> Response:
525
554
  "/api/tree/html", methods=["GET", "HEAD"], response_class=HTMLResponse
526
555
  )
527
556
  async def tree_html(request: Request, path: str = "") -> Response:
528
- # This is the interface's explicit Refresh control, so it must bypass the
529
- # tree cache and show files created since the last scan.
557
+ # This endpoint forces a rescan and returns only the tree fragment. The
558
+ # interface's Reload control uses /reload instead, which invalidates the
559
+ # tree cache and reloads the complete page.
530
560
  tree = await _safe_tree(request, fresh=True)
531
561
  return _html(
532
562
  request,
@@ -194,7 +194,6 @@ samp {
194
194
  }
195
195
 
196
196
  .tool-button,
197
- .panel-action,
198
197
  .tab {
199
198
  display: inline-flex;
200
199
  align-items: center;
@@ -215,7 +214,6 @@ samp {
215
214
  }
216
215
 
217
216
  .tool-button:hover,
218
- .panel-action:hover,
219
217
  .tab:hover {
220
218
  border-color: var(--border-strong);
221
219
  background: var(--surface-muted);
@@ -223,7 +221,6 @@ samp {
223
221
  }
224
222
 
225
223
  .tool-button:active,
226
- .panel-action:active,
227
224
  .tab:active {
228
225
  transform: translateY(1px);
229
226
  }
@@ -331,14 +328,6 @@ samp {
331
328
  text-transform: uppercase;
332
329
  }
333
330
 
334
- .panel-action {
335
- min-height: 1.6rem;
336
- padding: 0.12rem 0.42rem;
337
- font-size: 0.68rem;
338
- letter-spacing: 0.03em;
339
- text-transform: none;
340
- }
341
-
342
331
  .content {
343
332
  min-width: 0;
344
333
  overflow: auto;
@@ -20,9 +20,6 @@
20
20
  aria-labelledby="tab-files" data-panel="files">
21
21
  <div class="panel-header">
22
22
  <span>Files</span>
23
- <button type="button" class="panel-action" id="tree-refresh"
24
- data-get="/api/tree/html" data-target="#directory-tree"
25
- data-swap="outerHTML">Refresh</button>
26
23
  </div>
27
24
  {% include "partials/directory_tree.html" %}
28
25
  </div>
@@ -7,18 +7,14 @@
7
7
  {% endif %}
8
8
  <div class="toolbar-spacer"></div>
9
9
  <div class="toolbar-actions">
10
+ <a class="tool-button"
11
+ href="{% if path %}/reload/{{ path|urlpath }}{% if mode == 'source' %}?mode=source{% endif %}{% else %}/reload{% endif %}">Reload</a>
10
12
  {% if path %}
11
13
  {% if mode == "source" %}
12
- <a class="tool-button" href="/view/{{ path|urlpath }}?mode=source"
13
- data-get="/view/{{ path|urlpath }}?mode=source" data-target="#content"
14
- data-push-url="true">Refresh</a>
15
14
  <a class="tool-button" href="/view/{{ path|urlpath }}"
16
15
  data-get="/view/{{ path|urlpath }}" data-target="#content"
17
16
  data-push-url="true">Rendered</a>
18
17
  {% else %}
19
- <a class="tool-button" href="/view/{{ path|urlpath }}"
20
- data-get="/view/{{ path|urlpath }}" data-target="#content"
21
- data-push-url="true">Refresh</a>
22
18
  {% if source_available %}
23
19
  <a class="tool-button" href="/view/{{ path|urlpath }}?mode=source"
24
20
  data-get="/view/{{ path|urlpath }}?mode=source" data-target="#content"
@@ -1,18 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdotserver
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Lightweight, read-only HTTP viewer for Markdown and Graphviz documentation
5
5
  Author-email: Alexey Agafonov <128855676+lucir13@users.noreply.github.com>
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/lucir13/markdotserver
8
8
  Project-URL: Repository, https://github.com/lucir13/markdotserver
9
9
  Project-URL: Issues, https://github.com/lucir13/markdotserver/issues
10
+ Project-URL: Changelog, https://github.com/lucir13/markdotserver/blob/main/CHANGELOG.md
10
11
  Keywords: markdown,graphviz,documentation,viewer,dot,svg
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
11
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
12
17
  Classifier: Programming Language :: Python :: 3 :: Only
13
18
  Classifier: Topic :: Documentation
14
19
  Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
15
- Classifier: Intended Audience :: Developers
20
+ Classifier: Typing :: Typed
16
21
  Requires-Python: >=3.12
17
22
  Description-Content-Type: text/markdown
18
23
  License-File: LICENSE
@@ -35,7 +40,8 @@ step, database or generated site, and the server never modifies the documentatio
35
40
  directory.
36
41
 
37
42
  [![CI](https://github.com/lucir13/markdotserver/actions/workflows/ci.yml/badge.svg)](https://github.com/lucir13/markdotserver/actions/workflows/ci.yml)
38
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
43
+ [![PyPI](https://img.shields.io/pypi/v/markdotserver.svg)](https://pypi.org/project/markdotserver/)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/lucir13/markdotserver/blob/main/LICENSE)
39
45
 
40
46
  ## Features
41
47
 
@@ -60,11 +66,10 @@ directory.
60
66
  - Bounded caching for the directory tree and rendered diagrams, and a dedicated
61
67
  worker pool so slow documents cannot stall the rest of the server.
62
68
 
63
- ## Requirements
69
+ ## Install
64
70
 
65
- - Python 3.12 or newer
66
- - Graphviz with the `dot` executable on `PATH`
67
- - A modern browser
71
+ `markdotserver` requires Python 3.12 or newer, Graphviz with the `dot` executable on
72
+ `PATH`, and a modern browser.
68
73
 
69
74
  Install Graphviz first, for example:
70
75
 
@@ -81,27 +86,31 @@ brew install graphviz
81
86
 
82
87
  Verify it with `dot -V`.
83
88
 
84
- ## Quick start
89
+ Then install the viewer from PyPI:
85
90
 
86
- From the repository root:
91
+ ```bash
92
+ python -m pip install markdotserver
93
+ ```
94
+
95
+ Verify the installation:
87
96
 
88
97
  ```bash
89
- python3.12 -m venv .venv
90
- source .venv/bin/activate
91
- python -m pip install --upgrade pip
92
- python -m pip install -e .
93
- python -m markdotserver --root examples --port 8765
98
+ markdotserver --version
94
99
  ```
95
100
 
96
- Open <http://127.0.0.1:8765/>. The server redirects to `examples/README.md`.
101
+ ## Quick start
97
102
 
98
- To serve your own documentation:
103
+ Point the server at an existing documentation directory:
99
104
 
100
105
  ```bash
101
- python -m markdotserver --root /path/to/docs
106
+ markdotserver --root /path/to/docs
102
107
  ```
103
108
 
104
- Useful options:
109
+ Open <http://127.0.0.1:8000/>. The root must already exist and be readable. If it
110
+ contains `README.md`, `readme.md`, `index.md` or `INDEX.md`, `/` redirects to that
111
+ document; otherwise a welcome page is shown.
112
+
113
+ ## Command-line options
105
114
 
106
115
  ```text
107
116
  --root DIRECTORY documentation root (default: current directory)
@@ -121,9 +130,19 @@ Useful options:
121
130
  --version print the version
122
131
  ```
123
132
 
124
- The root must already exist and be readable. If it contains `README.md`,
125
- `readme.md`, `index.md` or `INDEX.md`, `/` redirects to that document; otherwise a
126
- welcome page is shown.
133
+ ## From a source checkout
134
+
135
+ From the repository root:
136
+
137
+ ```bash
138
+ python3.12 -m venv .venv
139
+ source .venv/bin/activate
140
+ python -m pip install --upgrade pip
141
+ python -m pip install -e .
142
+ python -m markdotserver --root examples --port 8765
143
+ ```
144
+
145
+ Open <http://127.0.0.1:8765/>. The server redirects to `examples/README.md`.
127
146
 
128
147
  ## Supported formats
129
148
 
@@ -165,7 +184,7 @@ Keep the default loopback bind and forward the port over SSH:
165
184
 
166
185
  ```bash
167
186
  # On the server
168
- python -m markdotserver --root /srv/docs --port 8765
187
+ markdotserver --root /srv/docs --port 8765
169
188
 
170
189
  # On the client
171
190
  ssh -L 8765:127.0.0.1:8765 user@server.example.com
@@ -193,7 +212,8 @@ Then open <http://127.0.0.1:8765/> locally.
193
212
  networks.
194
213
 
195
214
  **Graphviz is not a sandbox.** DOT files must be trusted; malicious graphs can still
196
- consume resources or exploit Graphviz bugs. See [Security](docs/security.md).
215
+ consume resources or exploit Graphviz bugs. See
216
+ [Security](https://github.com/lucir13/markdotserver/blob/main/docs/security.md).
197
217
 
198
218
  ## Testing
199
219
 
@@ -217,27 +237,31 @@ manually against `examples/`.
217
237
 
218
238
  ## Documentation
219
239
 
220
- - [Documentation index](docs/index.md)
221
- - [Installation](docs/installation.md)
222
- - [Usage](docs/usage.md)
223
- - [Supported formats](docs/formats.md)
224
- - [Architecture](docs/architecture.md)
225
- - [Security](docs/security.md)
226
- - [Testing](docs/testing.md)
227
- - [Limitations](docs/limitations.md)
228
- - [Detailed design](docs/design.md)
229
- - [Security policy](SECURITY.md)
230
- - [Third-party notices](THIRD_PARTY_NOTICES.md)
240
+ - [Documentation index](https://github.com/lucir13/markdotserver/blob/main/docs/index.md)
241
+ - [Installation](https://github.com/lucir13/markdotserver/blob/main/docs/installation.md)
242
+ - [Usage](https://github.com/lucir13/markdotserver/blob/main/docs/usage.md)
243
+ - [Supported formats](https://github.com/lucir13/markdotserver/blob/main/docs/formats.md)
244
+ - [Architecture](https://github.com/lucir13/markdotserver/blob/main/docs/architecture.md)
245
+ - [Security](https://github.com/lucir13/markdotserver/blob/main/docs/security.md)
246
+ - [Testing](https://github.com/lucir13/markdotserver/blob/main/docs/testing.md)
247
+ - [Limitations](https://github.com/lucir13/markdotserver/blob/main/docs/limitations.md)
248
+ - [Detailed design](https://github.com/lucir13/markdotserver/blob/main/docs/design.md)
249
+ - [Changelog](https://github.com/lucir13/markdotserver/blob/main/CHANGELOG.md)
250
+ - [Security policy](https://github.com/lucir13/markdotserver/blob/main/SECURITY.md)
251
+ - [Third-party notices](https://github.com/lucir13/markdotserver/blob/main/THIRD_PARTY_NOTICES.md)
231
252
 
232
253
  ## Project status
233
254
 
234
255
  The project is feature-complete: package scaffolding, configuration and path
235
256
  confinement, Graphviz and Markdown rendering, the HTTP interface, the two-pane
236
257
  interface, the example tree, complete documentation, hardening and acceptance
237
- verification are all in place. See the [detailed design](docs/design.md) for the
238
- architecture and implementation decisions.
258
+ verification are all in place. Releases are published on
259
+ [PyPI](https://pypi.org/project/markdotserver/). See the
260
+ [detailed design](https://github.com/lucir13/markdotserver/blob/main/docs/design.md)
261
+ for the architecture and implementation decisions.
239
262
 
240
263
  ## Licence
241
264
 
242
- MIT. See [LICENSE](LICENSE). Reuse and redistribution are permitted provided the
265
+ MIT. See [LICENSE](https://github.com/lucir13/markdotserver/blob/main/LICENSE). Reuse
266
+ and redistribution are permitted provided the
243
267
  copyright notice and permission notice in that file are retained with the software.
File without changes
File without changes