Merge pull request #22 from javiiariass/feat/internal-wikilinks

feat: internal wikilinks in exported PDF
This commit is contained in:
Walid 2026-06-12 20:00:47 +06:00 committed by GitHub
commit efe1ec6ff7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 19 deletions

38
main.js

File diff suppressed because one or more lines are too long

View file

@ -433,6 +433,12 @@ function postProcessRenderedHTML(root: HTMLElement): void {
// The external-link class triggers a ↗ icon via theme CSS — meaningless in print.
root.querySelectorAll<HTMLAnchorElement>("a").forEach((a) => {
a.classList.remove("external-link");
//Wikilinks
const target = a.getAttribute("data-href") ?? a.getAttribute("href");
if (target?.startsWith("#")) {
a.setAttribute("href", "#" + slugifyHeading(target.slice(1)));
}
});
root.querySelectorAll(".copy-code-button").forEach((el) => el.remove());