summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-02 22:40:31 +0300
committerYuriy Andamasov <yuriy@vyos.io>2026-05-06 16:18:42 +0300
commitf0be44482b64e0c8e21187074dbb74d9de7d6fb9 (patch)
tree0f002fa458edee0a29e2c43cd59a83c412a5621b /docs
parent59686997a365f1baec65419642cb1197eeefd611 (diff)
downloadvyos-documentation-f0be44482b64e0c8e21187074dbb74d9de7d6fb9.tar.gz
vyos-documentation-f0be44482b64e0c8e21187074dbb74d9de7d6fb9.zip
feat(conf): copy .md sources into HTML output for plain-text serving
Adds a build-finished hook that mirrors every .md file from the Sphinx source tree into the HTML output directory verbatim, making unrendered MyST sources accessible alongside HTML renders at the same URL path. 🤖 Generated by [robots](https://vyos.io)
Diffstat (limited to 'docs')
-rw-r--r--docs/conf.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/docs/conf.py b/docs/conf.py
index 612ae577..6cccac3e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,6 +13,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
+import shutil
import sys
sys.path.append(os.path.abspath("./_ext"))
@@ -235,5 +236,18 @@ def _prefer_webp(app):
app.builder.supported_image_types = ['image/webp'] + types
+def _copy_md_sources(app, exception):
+ """Copy .md source files verbatim into the HTML output tree."""
+ if exception is not None:
+ return
+ src = pathlib.Path(app.srcdir)
+ out = pathlib.Path(app.outdir)
+ for path in src.rglob("*.md"):
+ dest = out / path.relative_to(src)
+ dest.parent.mkdir(parents=True, exist_ok=True)
+ shutil.copy2(path, dest)
+
+
def setup(app):
- app.connect('builder-inited', _prefer_webp) \ No newline at end of file
+ app.connect('builder-inited', _prefer_webp)
+ app.connect('build-finished', _copy_md_sources) \ No newline at end of file