Codebase tour

Codebase Overview

The Mr.Docs codebase is divided into several modules:

graph TD %% Define styles for visual clarity classDef input fill:#D1E8FF,stroke:#005CFF,stroke-width:2; classDef artifact fill:#FFF5D1,stroke:#FFA500,stroke-width:2; classDef output fill:#D1FFD1,stroke:#008000,stroke-width:2; %% Define Inputs subgraph Inputs CF[Configuration File] CL[Command Line Arguments] end class CL,CF input %% Define Artifacts subgraph Processes P[Configuration Options] CD[Compilation Database] C[Corpus] G[Generator] end class P artifact class CD,C,G artifact %% Define Outputs subgraph Outputs D[Documentation] end class D output %% Relationships CF -->|Define| P CL -->|Define| P P -->|Defines| CD CD -->|Extract Symbols| C C -->|Feeds| G G -->|Produces| D %% Highlight dependencies for clarity P -->|Influences| G

This section provides an overview of each module and how they interact with each other in the Mr.Docs codebase.

Directory Layout

The MrDocs codebase is organized as follows:

include/—The main include directory

This directory contains the public headers for the MrDocs library.

  • include/mrdocs/—The core library headers

    • include/mrdocs/ADT—Data Structures

    • include/mrdocs/Config—Configuration classes

    • include/mrdocs/MetadataSymbol nodes and metadata classes

    • include/mrdocs/Support—Various utility classes

src/—The main source directory

This directory contains the source code for the MrDocs core library and its private headers.

  • src/mrdocs/—The core library

    • src/mrdocs/AST/—The AST traversal code

    • src/mrdocs/Gen/—Generators

    • src/mrdocs/Metadata/Symbol nodes and metadata classes

    • src/mrdocs/Support/—Various utility classes

libs/—Standalone libraries

Self-contained libraries extracted from the core so each can be built and tested on its own.

  • libs/dom/—The Document Object Model for Abstract Trees

  • libs/handlebars/—The Handlebars template engine

  • libs/polyfill/—Standard-library polyfills

  • libs/test_suite/—The library used for testing

tools/—Executables

  • tools/mrdocs/—The main program

tests/—Tests

  • tests/unit/—Unit tests

  • tests/golden/—Golden-file regression tests and their fixtures

data/—Shared resources

This directory contains shared resources for the documentation generators and utilities for developers. Its subdirectories are installed in the share directory of the installation.

  • data/—Shared resources for the documentation generators

  • data/cmake/—CMake modules to generate the documentation

  • data/gdb/—GDB pretty printers

  • data/mrdocs/—Shared resources for the documentation generators

docs—Documentation

This directory contains the documentation for the MrDocs project. The documentation is written in AsciiDoc and can be built using the Antora tool.

  • docs/—Documentation configuration files and scripts

    • docs/modules/—The documentation asciidoc files

    • docs/extensions—Antora extensions for the documentation

utils/bootstrap/—Helpers for third-party libraries

This directory contains build scripts and configuration files for third-party libraries.