pub fn transform_links(
html: &str,
current_path: &Path,
path_to_filename: &HashMap<PathBuf, String>,
workspace_dir: &Path,
dest_filename: &str,
) -> StringExpand description
Rewrite internal .md hyperlinks in rendered HTML to their published
.html destinations, resolving relative/workspace-root paths via the
path_to_filename map. External links, anchors, and non-.md hrefs are
left untouched.
The lookup key is sanitized the same way path_to_filename’s keys are (see
sanitize_rel_path), so a link like First post!.md resolves to the
stored First post.html instead of a fabricated First post!.html.
A link whose target is not in this render set (excluded by audience
visibility, or simply missing) is stripped: the <a> becomes a
<span class="unpublished-link"> that keeps the link text but isn’t
clickable, so the page never points at something that 404s.
Everything that is not a document link — an image, a PDF, an HTML
attachment’s island <iframe> — is then put through
rebase_root_absolute, because a vault writes those paths from the vault
root (/img/photo.png, prov’s path_style: root) and a site is not always
served from a domain root.