[llvm] [docs] Replace llvm.org/docs links with project links (PR #222506)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 10:59:00 PDT 2026
================
@@ -36,7 +36,7 @@ instead of string triplets, streamlining the training data preparation workflow.
:::{note}
For information about using IR2Vec and MIR2Vec programmatically within LLVM
-passes and the C++ API, see the [IR2Vec Embeddings](https://llvm.org/docs/MLGO.html#ir2vec-embeddings)
+passes and the C++ API, see the {ref}`IR2Vec Embeddings <ir2vec-embeddings>`
section in the MLGO documentation.
----------------
rnk wrote:
After a long investigation, yes, it turns out we can do that, and we'll still have cross-reference checking, and I agree, the markdown syntax is better.
I grew the scope of this change to update the SphinxQuickstarteGuide.md docs to include recommendations about how to write cross-references, so take a look at that, it should codify what you're after.
The main issue is that there are two kinds of labels:
1. auto-generated section header slugs
2. explicit Sphinx labels, with the `(project-global-label)=` syntax
Cross-references to sections are fragile under section header renames, but fortunately, Myst actually checks them, so a header rename will actually break the doc build and we'll find it and fix it, so in the vast majority of cross-referencing cases, I would prefer style #1, and that's what I propose we do.
There are some cases where you need mid-section label refs, table refs, or figure refs, and for that, we should use Sphinx roles like `{ref}` etc.
I added some checks to the absolute link checker to warn people when they write doc links that don't follow this proposed recommended policy. PTAL
----
After this is done, I can clean up a ton of unnecessary explicit labels, which @llvm-beanz pointed out pollute the github markdown rendering. We can keep some explicit labels for things we really want to remain stable, such as perhaps coding guidelines.
https://github.com/llvm/llvm-project/pull/222506
More information about the llvm-commits
mailing list