markdotserver 0.1.1__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.1/src/markdotserver.egg-info → markdotserver-0.2.0}/PKG-INFO +1 -1
  2. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/__init__.py +1 -1
  3. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/filesystem.py +2 -2
  4. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/markdown_renderer.py +0 -1
  5. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/routes.py +32 -2
  6. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/static/css/app.css +0 -11
  7. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/templates/index.html +0 -3
  8. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/templates/partials/toolbar.html +2 -6
  9. {markdotserver-0.1.1 → markdotserver-0.2.0/src/markdotserver.egg-info}/PKG-INFO +1 -1
  10. {markdotserver-0.1.1 → markdotserver-0.2.0}/LICENSE +0 -0
  11. {markdotserver-0.1.1 → markdotserver-0.2.0}/README.md +0 -0
  12. {markdotserver-0.1.1 → markdotserver-0.2.0}/pyproject.toml +0 -0
  13. {markdotserver-0.1.1 → markdotserver-0.2.0}/setup.cfg +0 -0
  14. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/__main__.py +0 -0
  15. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/app.py +0 -0
  16. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/config.py +0 -0
  17. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/graphviz_renderer.py +0 -0
  18. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/py.typed +0 -0
  19. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/static/js/app.js +0 -0
  20. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/static/js/theme.js +0 -0
  21. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/templates/base.html +0 -0
  22. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/templates/partials/directory_tree.html +0 -0
  23. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/templates/partials/document.html +0 -0
  24. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/templates/partials/error.html +0 -0
  25. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver/templates/partials/headings.html +0 -0
  26. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver.egg-info/SOURCES.txt +0 -0
  27. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver.egg-info/dependency_links.txt +0 -0
  28. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver.egg-info/entry_points.txt +0 -0
  29. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver.egg-info/requires.txt +0 -0
  30. {markdotserver-0.1.1 → markdotserver-0.2.0}/src/markdotserver.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdotserver
3
- Version: 0.1.1
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
@@ -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.1"
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdotserver
3
- Version: 0.1.1
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
File without changes
File without changes
File without changes