Fix bad links in docs code blocks (#6649)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-02 16:00:27 +12:00
committed by GitHub
parent 819ee23565
commit 6866c9d418
87 changed files with 289 additions and 285 deletions

View File

@ -577,12 +577,16 @@ fn cleanup_type_string(input: &str, fmt_for_text: bool) -> String {
ty
};
if SPECIAL_TYPES.contains(&ty) {
// TODO markdown links in code blocks are not turned into links by our website stack.
// If we can handle signatures more manually we could get highlighting and links and
// we might want to restore the links by not checking `fmt_for_text` here.
if fmt_for_text && SPECIAL_TYPES.contains(&ty) {
format!("[{prefix}{ty}{suffix}](/docs/kcl/types#{ty})")
} else if DECLARED_TYPES.contains(&ty) {
} else if fmt_for_text && DECLARED_TYPES.contains(&ty) {
format!("[{prefix}{ty}{suffix}](/docs/kcl/types/std-types-{ty})")
} else {
format!("{prefix}{input}{suffix}")
format!("{prefix}{ty}{suffix}")
}
})
.collect();