Skip to content

Commit e800038

Browse files
committed
fix(build-docs): create extra README.md symlinks for READMEs linked from CONTRIBUTING
CONTRIBUTING.md links to `check-plugins/example/README.md` and `check-plugins/php-fpm-status/README.md` as the reference READMEs for structure and detail depth. Both links need to resolve in two different rendering contexts: - On GitHub, where the link is relative to CONTRIBUTING.md at the repo root and points at the real README file in the plugin subdirectory. - On the mkdocs-rendered docs site, where the link is resolved against the docs_dir and therefore needs a doc file at `docs/check-plugins/<name>/README.md`. `tools/build-docs` already created the extra symlink for `example` but not for `php-fpm-status`, which made mkdocs strict-mode fail on the docs-build CI job with: WARNING - Doc file 'contributing.md' contains a link 'check-plugins/php-fpm-status/README.md', but the target is not found among documentation files. Aborted with 1 warnings in strict mode! Generalise the special case: extract a `README_LINKED_FROM_CONTRIBUTING` list at the top of build-docs, create an extra symlink under `docs/check-plugins/<name>/README.md` for every entry, and add every entry to `not_in_nav` so mkdocs does not complain about a doc file that is outside the main navigation. Adding a new CONTRIBUTING.md reference now means appending one name to the list. `example` stays excluded from the main nav because it is a template, not a plugin; `php-fpm-status` still appears in the nav via its normal `check-plugins/php-fpm-status.md` docs page and only gets the extra README.md symlink on top of that.
1 parent dfaada9 commit e800038

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

tools/build-docs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,30 @@ import os
1616
import sys
1717

1818
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
19-
__version__ = '2026040701'
19+
__version__ = '2026041501'
2020

2121
REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
2222
DOCS_DIR = os.path.join(REPO_ROOT, 'docs')
2323

24+
# Check plugins whose README is also reachable under
25+
# `docs/check-plugins/<name>/README.md` so that markdown links like
26+
# `[text](check-plugins/<name>/README.md)` from CONTRIBUTING.md
27+
# resolve both on GitHub (where the link points at the real README
28+
# file in the plugin subdirectory) and on the rendered mkdocs site
29+
# (where the symlink created here shadows the subdirectory). The
30+
# default `tools/build-docs` layout only publishes one doc page per
31+
# plugin at `docs/check-plugins/<name>.md`; this list adds the
32+
# second form where it is needed.
33+
#
34+
# `example` is also excluded from the main nav because it is a
35+
# template rather than a real plugin; every other entry in this
36+
# list still shows up in the nav normally via its primary docs
37+
# page and only gets an *additional* README.md symlink.
38+
README_LINKED_FROM_CONTRIBUTING = [
39+
'example',
40+
'php-fpm-status',
41+
]
42+
2443
# Top-level markdown files to include in the documentation.
2544
# Format: (source filename, target filename in docs/, nav title)
2645
TOP_LEVEL_DOCS = [
@@ -122,7 +141,8 @@ def generate_mkdocs_yml(nav_sections):
122141
lines.append('')
123142
lines.append('not_in_nav: |')
124143
lines.append(' CHANGELOG.md')
125-
lines.append(' check-plugins/example/README.md')
144+
for name in sorted(README_LINKED_FROM_CONTRIBUTING):
145+
lines.append(f' check-plugins/{name}/README.md')
126146
lines.append(' CODE_OF_CONDUCT.md')
127147
lines.append('')
128148

@@ -193,13 +213,16 @@ def main():
193213
with open(mkdocs_path, 'w') as f:
194214
f.write(mkdocs_content)
195215

196-
# Create symlink for the example plugin (not in nav, but linked from contributing.md)
197-
example_source = os.path.join(REPO_ROOT, 'check-plugins', 'example', 'README.md')
198-
if os.path.isfile(example_source):
199-
example_target_dir = os.path.join(DOCS_DIR, 'check-plugins', 'example')
200-
os.makedirs(example_target_dir, exist_ok=True)
201-
example_target = os.path.join(example_target_dir, 'README.md')
202-
create_symlink(example_source, example_target)
216+
# Create extra README.md symlinks under docs/check-plugins/<name>/
217+
# for every plugin linked from CONTRIBUTING.md. See the comment on
218+
# README_LINKED_FROM_CONTRIBUTING at the top of this file.
219+
for name in README_LINKED_FROM_CONTRIBUTING:
220+
src = os.path.join(REPO_ROOT, 'check-plugins', name, 'README.md')
221+
if not os.path.isfile(src):
222+
continue
223+
tgt_dir = os.path.join(DOCS_DIR, 'check-plugins', name)
224+
os.makedirs(tgt_dir, exist_ok=True)
225+
create_symlink(src, os.path.join(tgt_dir, 'README.md'))
203226

204227
# Count
205228
total_symlinks = len(TOP_LEVEL_DOCS)

0 commit comments

Comments
 (0)