From 6c1390bb31c7fe95a67e8641bbd08d951bd74e8c Mon Sep 17 00:00:00 2001 From: Philipp Wagner Date: Mon, 22 Jun 2026 10:48:52 +0200 Subject: [PATCH] Add support for cross-document references Implement :doc:/:ref:/:confval:/etc. cross-references in the Typst builder, following the same approach as Sphinx's LaTeX builder: all documents are merged into a single doctree, and Sphinx's standard env.resolve_references() runs against that merged tree right after merging. This lets Sphinx's own domains handle path normalization, label lookup, title substitution, and intersphinx exactly as they do for any other builder. Builder.get_target_uri()/get_relative_uri() map a docname onto the single merged Typst document, mirroring the LaTeX builder's "%docname" convention. The writer's job is then only to translate the refid/refuri that Sphinx resolves into a namespaced Typst label (); the namespace keeps ids from colliding across documents now that they all share one output file. A small per-document "#metadata(none)