Skip to content

docs: S23.22 drop the Doxygen kind from generated API headings - #747

Merged
DavidCozens merged 2 commits into
mainfrom
docs/api-member-headings
Aug 11, 2026
Merged

docs: S23.22 drop the Doxygen kind from generated API headings#747
DavidCozens merged 2 commits into
mainfrom
docs/api-member-headings

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Part of #708.

Every heading on a generated API page carried its Doxygen kind — function SolidSyslogFile_Close, define SOLIDSYSLOG_FILE_POOL_SIZE, variable Acquire
— and each page's table of contents repeated the word once per member. The
section above the heading already names the kind, so the prefix only pushed the
name to the right in the one place a reader scans.

Change Description

A build hook, hooks/api_member_headings.py, drops the kind from the 311
member headings across functions, macros, enums, typedefs and struct members.

The heading text is what MkDocs turns into the anchor, so dropping a word moves
every anchor on the page and breaks the links pointing at it. Those links exist
in three places: mkdoxy links its own header and directory pages at the members
they declare, hardening-path.md and api-reference/index.md carry eight
#function- links, and the product page on the company website links
#function-solidsyslog_log and #function-solidsyslog_service. Nothing
validates a link pointing into the site, so that breakage would not surface.

Each heading therefore states its old anchor explicitly, via attr_list. The
anchor is not reconstructed by rule — it is produced by calling the same
slugify the site configures for toc, so it matches whatever that would have
generated, including cases no rule of mine would have got right.

Anonymous enums keep their kind. Doxygen names them @0@5, and a heading
reading @0 says less than enum @0.

The second commit makes anchor validation fatal under --strict. It was held
at info for anchors like #enum-@0 that mkdoxy was said to emit; nothing in
the built site links to an @-style anchor any more, and the strict build
reports no unresolved anchor, so the exemption bought nothing. It cost
something: the first version of this change broke 17 mkdoxy cross-page links
and the build stayed green while reporting them at info.

Test Evidence

Nine new tests in hooks/test_api_member_headings.py, driven red first — the
opening test failed on a missing module, and the generalisation to function
failed on the un-rewritten heading before the kinds were folded together.
They cover each kind mkdoxy emits, the anchor each heading keeps, the
anonymous-enum exception, hand-written pages being untouched, and a cross-page
link still resolving.

  • 99 hook tests pass in the mkdocs-mkdoxy image
  • mkdocs build --strict exits 0
  • scripts/check_platform_docs.py exits 0

The anchors are verified by comparison rather than by argument. Every anchor on
the published site was captured first — 957 across 230 generated pages — then
the site was rebuilt and the two compared: no anchor was lost, including
the two the product page links to.

The new gate is proved to fail: a link to a nonexistent anchor aborts the
strict build with exit 1, naming the file, the link and the missing anchor.

Areas Affected

hooks/ and mkdocs.yml. Documentation build only — no library source, no
public headers, no CI workflow changes. The generated api/ tree is
git-ignored, so the effect is visible only in a built site.

Anchor validation becoming fatal applies to every page, not just generated
ones: a hand-written link to a heading that later moves now fails the build
rather than logging at info.

Summary by CodeRabbit

  • New Features

    • API documentation headings now display member names without technical kind prefixes such as “function” or “variable”.
    • Existing page anchors and cross-page links remain unchanged.
    • Table-of-contents entries reflect the improved headings.
  • Bug Fixes

    • Anonymous enum headings and hand-written documentation remain unaffected.
    • API link validation now reports relevant issues as warnings during documentation builds.

DavidCozens and others added 2 commits August 11, 2026 07:14
mkdoxy titles every member with its kind, so pages read "function
SolidSyslogFile_Close", "define SOLIDSYSLOG_FILE_POOL_SIZE", "variable
Acquire", and each table of contents repeated the word once per member.
The section above already names the kind, so the prefix only pushed the
name to the right: 311 headings across functions, macros, enums, typedefs
and struct members.

The heading text is what MkDocs turns into the anchor, so dropping a word
would move every anchor and break the links pointing at it — mkdoxy links
its own pages that way, two hand-written pages use #function- anchors, and
so does the product page on the company website. Nothing validates an
inbound link, so that breakage would not have surfaced. Each heading
therefore states its old anchor explicitly, generated by calling the same
slugify the site configures for toc rather than reconstructed by rule.

Verified against the published site: all 957 anchors on the 230 generated
pages still exist after the change. Anonymous enums keep their kind, since
a heading reading "@0" says less than "enum @0".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Anchor validation was held at info because the mkdoxy-generated pages were
said to emit anchors like #enum-@0 that could not resolve. Nothing in the
built site links to an @-style anchor any more, and a strict build reports
no unresolved anchor, so the exemption bought nothing.

It cost something, though: renaming the generated member headings broke 17
mkdoxy cross-page links, and the build stayed green while reporting them at
info. A link into a heading that has moved is what this validation is for.

Proved it fails: a link to a nonexistent anchor aborts the strict build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR adds a MkDocs hook that removes supported Doxygen member-kind prefixes from generated API headings. It preserves original anchors, excludes anonymous enums, limits changes to api/ pages, and adds unit-test coverage.

Changes

API heading normalisation

Layer / File(s) Summary
Heading transformation rules
hooks/api_member_headings.py
The hook matches supported function, define, enum, typedef, and variable headings. It removes the kind prefix and adds an explicit anchor based on the original heading. Anonymous enum headings remain unchanged.
MkDocs hook integration
hooks/api_member_headings.py, mkdocs.yml
MkDocs loads the hook for generated api/ pages. Anchor validation now reports missing in-page anchors as warnings.
Hook behaviour validation
hooks/test_api_member_headings.py
Tests cover heading changes, anonymous enums, unchanged prose and hand-written pages, anchor preservation, and cross-page links.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MkDocs
  participant on_page_markdown
  participant GeneratedApiPage
  participant AnchorValidation
  MkDocs->>on_page_markdown: generated markdown for an api/ page
  on_page_markdown->>GeneratedApiPage: match and retitle supported headings
  GeneratedApiPage-->>MkDocs: headings with preserved anchors
  MkDocs->>AnchorValidation: rendered links and anchors
  AnchorValidation-->>MkDocs: warnings for missing anchors
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses Conventional Commits format and clearly states the main documentation change: removing Doxygen kinds from generated API headings.
Description check ✅ Passed The description covers purpose, implementation, tests, affected areas, anchor preservation, and strict-build behaviour with specific evidence.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/api-member-headings

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   JUnit   build-linux-gcc (Whole Project): ✅ successful — 1529 passed
   JUnit   build-freertos-host-tdd-plustcp (Whole Project): ✅ successful — 1881 passed
   JUnit   build-linux-clang (Whole Project): ✅ successful — 1460 passed
   JUnit   sanitize-linux-gcc (Whole Project): ✅ successful — 1460 passed
   JUnit   integration-linux-openssl (Whole Project): ✅ successful — 16 passed
   JUnit   integration-linux-mbedtls (Whole Project): ✅ successful — 14 passed
   JUnit   integration-windows-openssl (Whole Project): ✅ successful — 16 passed
   JUnit   bdd-linux-syslog-ng (Whole Project): ✅ successful — 49 passed, 3 skipped
   JUnit   bdd-windows-otel (Whole Project): ✅ successful — 46 passed, 6 skipped
   JUnit   bdd-freertos-qemu-plustcp (Whole Project): ✅ successful — 45 passed, 7 skipped
   JUnit   bdd-freertos-qemu-lwip (Whole Project): ✅ successful — 45 passed, 7 skipped
   JUnit   build-windows-msvc (Whole Project): ✅ successful — 1302 passed
   JUnit   build-linux-tunable-override (Whole Project): ✅ successful — 1460 passed
   ⚠️   Clang-Tidy (Whole Project): No warnings
   ⚠️   CPPCheck (Whole Project): No warnings


Created by Quality Monitor v4.15.0 (#82d77af). More details are shown in the GitHub Checks Result.

@DavidCozens
DavidCozens marked this pull request as ready for review August 11, 2026 06:34

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hooks/test_api_member_headings.py`:
- Around line 69-73: Update test_a_cross_page_link_to_a_member_still_resolves to
render the target structSolidSyslogConfig.md content containing the Clock member
heading, then assert the rendered output includes the explicit `#variable-clock`
anchor rather than only checking the source link text in out.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 46f7cdbf-0b23-449e-830a-26f709dad018

📥 Commits

Reviewing files that changed from the base of the PR and between c23e7e3 and a764146.

📒 Files selected for processing (3)
  • hooks/api_member_headings.py
  • hooks/test_api_member_headings.py
  • mkdocs.yml

Comment thread hooks/test_api_member_headings.py
@DavidCozens
DavidCozens merged commit c6eb04c into main Aug 11, 2026
36 checks passed
@DavidCozens
DavidCozens deleted the docs/api-member-headings branch August 11, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant