From 486474c99a00e628f3568d2907376dc3560ac6c2 Mon Sep 17 00:00:00 2001 From: Etienne Bacher <52219252+etiennebacher@users.noreply.github.com> Date: Fri, 24 Nov 2023 18:49:53 +0100 Subject: [PATCH 1/2] link functions --- R/qmd2md.R | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/R/qmd2md.R b/R/qmd2md.R index 4068982b..baff35ac 100644 --- a/R/qmd2md.R +++ b/R/qmd2md.R @@ -25,10 +25,24 @@ ) } + .link_functions(tar_file) out <- !inherits(out, "try-error") return(out) } +# Custom wrapper around `downlit::downlit_md_path()` +.link_functions <- function(path) { + op <- "/man" + names(op) <- .pkg_name(".") + options(downlit.local_packages = op) + downlit:::downlit_md_path(path, path) + content <- .readlines(path) + # links in code blocks + fixed <- gsub("/man/reference/([^.]+)\\.html", "#/man/\\1.md", content) + # links in inline code + fixed <- gsub("/man/reference/([^.]+)\\.html", "/man/\\1.md", fixed) + writeLines(fixed, path) +} From a1ca0fe28b7503a660c0c0bbdd21c17f90a73ae9 Mon Sep 17 00:00:00 2001 From: Etienne Bacher <52219252+etiennebacher@users.noreply.github.com> Date: Fri, 24 Nov 2023 18:55:50 +0100 Subject: [PATCH 2/2] import downlit --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 585c05f5..110e2933 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,6 +20,7 @@ BugReports: https://github.com/etiennebacher/altdoc/issues Imports: cli, desc, + downlit, fs, quarto, tools,