|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
How to add, edit, and organize documentation pages in DNDSR. The project uses a dual doc system: content lives in shared Markdown files consumed by both Doxygen and Sphinx.
Every .md file under guides/, architecture/, theory/, tests/, dev/ is consumed by both Doxygen and Sphinx. Doxygen reads them natively; Sphinx reads them via MyST-Parser, and the doxygen_compat.py extension translates Doxygen commands (@ref, @tableofcontents, etc.) into MyST equivalents.
Place it in the appropriate directory under docs/:
| Section | Directory | Example |
|---|---|---|
| Guides | docs/guides/ | docs/guides/my_guide.md |
| Architecture | docs/architecture/ | docs/architecture/my_design.md |
| Theory | docs/theory/ | docs/theory/my_method.md |
| Tests | docs/tests/ | docs/tests/my_tests.md |
| Dev notes | docs/dev/ | docs/dev/my_notes.md |
The file must start with a heading that includes a {#page_id} anchor:
The {#my_guide} anchor serves both systems:
@subpage / @ref.(my_guide)= by doxygen_compat.py).Edit docs/doxygen/main.dox. Find the parent section page and add a @subpage entry:
The @subpage my_guide creates a parent → child relationship in the Doxygen sidebar tree. Without it, the page becomes an orphan at the top level.
Edit the corresponding Sphinx toctree stub in docs/sphinx/. For a guide, edit docs/sphinx/guides.md:
Paths are absolute from the Sphinx source root (docs/), so /guides/my_guide resolves to docs/guides/my_guide.md.
The file docs/doxygen/main.dox defines the entire Doxygen sidebar hierarchy using @mainpage, @page, and @subpage. The structure is:
Rules:
@mainpage can only appear once. It defines the root page.@page page_id Title creates a named page.@subpage child_id inside a @page block creates a parent-child edge in the sidebar tree.@subpage becomes an orphan — it appears at the top level alongside Namespaces/Classes/Files.child_id must match the {#child_id} anchor in the .md file.Each section has a stub file that defines the Sphinx sidebar tree using MyST toctree directives:
| Stub file | Section |
|---|---|
docs/sphinx/guides.md | Guides |
docs/sphinx/architecture.md | Architecture |
docs/sphinx/theory.md | Theory |
docs/sphinx/tests.md | Unit Tests |
docs/sphinx/dev.md | Development Notes |
The stubs are referenced from docs/index.md (the Sphinx root):
Rules:
docs/)./guides/building resolves to docs/guides/building.md.Use Doxygen's @ref syntax. The doxygen_compat.py extension translates these for Sphinx automatically.
{#array_infrastructure}.[array_infrastructure](#array_infrastructure), which MyST resolves to the page with (array_infrastructure)= label.For references with custom display text:
See the C++ Docstrings section of the Style Guide for @ref usage in source comments.
This Sphinx extension (docs/sphinx/_ext/doxygen_compat.py) runs as a source-read hook, rewriting Doxygen commands before MyST parses the Markdown. Translations:
| Doxygen command | Sphinx/MyST equivalent |
|---|---|
# Title {#id} | (id)= label + # Title |
@ref anchor | [anchor](#anchor) |
@ref anchor "text" | [text](#anchor) |
@subpage anchor | [anchor](#anchor) |
@tableofcontents | {contents}directive \ilinebr </td> </tr> <tr class="markdownTableRowEven"> <td class="markdownTableBodyNone"> |
</td> <td class="markdownTableBodyNone">## Title\ilinebr </td> </tr> <tr class="markdownTableRowOdd"> <td class="markdownTableBodyNone">
</td> <td class="markdownTableBodyNone">### Title\ilinebr </td> </tr> <tr class="markdownTableRowEven"> <td class="markdownTableBodyNone">
\ilinebr </td> <td class="markdownTableBodyNone"> **See also:** *target* \ilinebr </td> </tr> <tr class="markdownTableRowOdd"> <td class="markdownTableBodyNone">\ilinebr </td> <td class="markdownTableBodyNone">{note} admonition \ilinebr </td> </tr> <tr class="markdownTableRowEven"> <td class="markdownTableBodyNone"> `@warning text` \ilinebr </td> <td class="markdownTableBodyNone"> `{warning} `admonition \ilinebr </td> </tr> <tr class="markdownTableRowOdd"> <td class="markdownTableBodyNone">fenced code block
| Target | Behavior | What it builds |
|---|---|---|
docs | Incremental (stamp-based) | Doxygen XML → Sphinx HTML + embedded Doxygen HTML |
sphinx | Always runs | Sphinx HTML (forces rebuild) |
doxygen | Always runs | Doxygen HTML + XML (forces rebuild) |
serve-docs | Incremental + prints serve command | Full site |
serve-doxygen | Forces doxygen + prints serve command | Doxygen standalone |
The docs target uses ninja dependency tracking:
ninja: no work to do (instant)docs/<section>/my_page.md with # Title {#page_id} heading@subpage page_id to the correct @page block in docs/doxygen/main.dox/section/my_page to the correct toctree in docs/sphinx/<section>.mdcmake --build build -t docs and verify both sidebars