summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorYuriy Andamasov <yuriy@vyos.io>2026-05-02 22:40:29 +0300
committerYuriy Andamasov <yuriy@vyos.io>2026-05-06 16:18:03 +0300
commitce48fd34ef9347947206c23f13332e6e32fe0be0 (patch)
treea5f9336f27767ba976f1fa71ab928d83a4dca9ec /docs
parent761c48779951605dbbce5345478c399b5793ae20 (diff)
downloadvyos-documentation-ce48fd34ef9347947206c23f13332e6e32fe0be0.tar.gz
vyos-documentation-ce48fd34ef9347947206c23f13332e6e32fe0be0.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.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/conf.py b/docs/conf.py
index c13397a9..ed3cc734 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"))
@@ -242,5 +243,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)
+ app.connect('build-finished', _copy_md_sources)