selfdoc v0.15.1 /selfdoc.unified
On this page

Monorepo unified site builder module that orchestrates building a single documentation site from multiple constituent projects with merged navigation.

#selfdoc.unified

#selfdoc.unified

Monorepo unified site builder.

Orchestrates building a single documentation site from multiple constituent projects plus a docs-site's own cross-cutting content. Each constituent project is built using its own selfdoc.json; the docs-site's config provides the unified orchestration via its unified section.

#_resolve_project_path

python
def _resolve_project_path(project_entry, docs_site_dir)

Resolve a constituent project's absolute path from its config entry.

The path value in the unified config is relative to the docs-site directory (e.g. ../core).

Returns the absolute project directory path. Raises ConfigError if the resolved path does not exist.

#_project_slug

python
def _project_slug(project_entry)

Derive the URL slug for a constituent project.

Uses the explicit slug field if set, otherwise the basename of the project path.

#_project_nav_title

python
def _project_nav_title(project_entry)

Derive the navigation title for a constituent project.

Uses the explicit nav_title field if set, otherwise titlecases the slug.

#_build_unified_nav

python
def _build_unified_nav(common_nav, projects_nav, config)

Merge navigation from common docs and constituent projects.

Returns a flat nav_items list suitable for _render_nav:

  • Common (docs-site) pages first
  • Then one collapsible group per constituent project

Args:

  • common_nav: Nav items from the docs-site's own docs.
  • projects_nav: List of (slug, nav_title, nav_items, url_prefix)

tuples, one per constituent project.

  • config: The docs-site's config dict.

#_generate_landing_page

python
def _generate_landing_page(projects_info, config)

Generate an HTML landing page listing all constituent projects as cards.

Args:

  • projects_info: List of dicts with keys: slug, nav_title, description,

version, url_prefix.

  • config: The docs-site config dict.

Returns:

  • HTML body string for the landing page.

#_validate_rlsbl_workspace

python
def _validate_rlsbl_workspace(docs_site_dir, unified_config)

Validate unified config against rlsbl monorepo workspace.

Walks up from docs_site_dir looking for .rlsbl-monorepo/workspace.toml. If found, checks that every workspace project with a selfdoc.json is either listed in unified.projects or unified.exclude.

Raises ConfigError if an undeclared selfdoc-enabled project is found.

#_merge_site_terms

python
def _merge_site_terms(all_terms)

Merge site_terms dicts from multiple projects.

Each entry in all_terms is a (project_slug, terms_dict) tuple. Returns a merged dict keyed by lowercase term, with project attribution added to each entry.

#_generate_unified_glossary_html

python
def _generate_unified_glossary_html(merged_terms, projects_info)

Generate a unified glossary page body from merged terms.

Groups terms alphabetically with project attribution. Returns HTML body string.

#build_unified

python
def build_unified(dir_path='.', config=None)

Build a unified documentation site from multiple constituent projects.

Main entry point for monorepo unified builds. Reads the unified section from the docs-site's config, builds each constituent project and the docs-site's own content, then assembles everything into a single output directory with merged search index, unified navigation, and shared assets.

Args:

  • dir_path: The docs-site's project root directory.
  • config: Pre-loaded config dict (if None, loads from selfdoc.json).

Returns:

  • Dict of {output_path: True} for files written.