mirror of
https://github.com/shrekbytes/advanced-pdf-export.git
synced 2026-07-22 07:25:03 +00:00
Merge pull request #22 from javiiariass/feat/internal-wikilinks
feat: internal wikilinks in exported PDF
This commit is contained in:
commit
efe1ec6ff7
2 changed files with 25 additions and 19 deletions
38
main.js
38
main.js
File diff suppressed because one or more lines are too long
6
main.ts
6
main.ts
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in a new issue