Skip to content

Support DocBook XML sources for complete systemd documentation #116

Description

@TheRealBecks

Context

This is a follow-up to #110. I investigated adding the complete systemd documentation as systemd/systemd using the official repository:

https://github.com/systemd/systemd

A Markdown-only registry definition builds successfully, but it omits most of systemd's authoritative documentation.

Findings

The upstream documentation is split into two parts:

  • docs/: 95 supported Markdown files
  • man/: 484 DocBook XML files, approximately 8.1 MB

The Markdown-only prototype produced:

  • 80 indexed documents
  • 523 sections
  • 219,498 tokens

This covers architectural and integration guides, but not the complete reference. Important documentation such as systemctl, journalctl, systemd.service, unit directives, network configuration, and most APIs lives under man/*.xml.

Context currently discovers Markdown, MDX, HTML, AsciiDoc, and reStructuredText, but not XML. Registry sources support Git and ZIP without a preprocessing step.

The XML cannot simply be treated as plain text:

  • 388 files use XInclude
  • 43 files reference generated entities
  • 483 files declare DocBook DTDs
  • upstream renders HTML using Meson and xsltproc --xinclude
  • generated HTML is not committed or provided as a release asset

The official rendered documentation is available at:

https://www.freedesktop.org/software/systemd/man/latest/

However, that site has no llms.txt, and the registry cannot currently build a package by following an HTML index.

Proposed solution

My preferred solution is safe native DocBook support:

  1. Recognize .xml files whose root document is a supported DocBook type such as refentry.
  2. Resolve XInclude/XPointer references only within the cloned documentation root.
  3. Resolve required local entities without allowing external network access or arbitrary filesystem access.
  4. Convert DocBook sections, lists, tables, examples, commands, filenames, variables, and program listings into the existing parsed-document representation.
  5. Add support for multiple documentation roots, for example docs and man, rather than scanning the entire source repository.
  6. Add security tests for external entities, path traversal, recursive includes, entity expansion, malformed XML, and oversized documents.

A possible alternative is a constrained HTML-index source that follows same-origin links from systemd's official rendered man-page index. This would be simpler for systemd but less reproducible and would make nightly builds depend on hundreds of individual website requests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions