The pkgdown autolinking vignette goes into some detail about how links are generated, both to other pages within the site itself, and to external documentation for other packages. I would like to know how to create such links myself. E.g, is there a function that can be run when building a site, something like generate_pkgdown_link("my_function")
that will create such a link. This would be useful, e.g. for creating HTML flow-charts etc that describe the package structure.
For anyone trying to answer the same question, there is a documented solution which I somehow missed when writing this question - use downlit::downlit_html_node()
, e.g.
node <- xml2::read_xml("<p><code>base::t()</code></p>")
node
#> {xml_document}
#> <p>
#> [1] <code>base::t()</code>
# node is modified in place
downlit::downlit_html_node(node)
node
#> {xml_document}
#> <p>
#> [1] <code>\n <a href="https://rdrr.io/r/base/t.html">base::t()</a>\n</code>
Created on 2021-04-09 by the reprex package (v2.0.0)