pegar links internos correctamente
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Cat /dev/Nulo 2023-04-20 09:08:11 -03:00
parent 7c8d36e7c3
commit 847a3731f9

View file

@ -307,15 +307,19 @@ export const schema = new Schema({
parseDOM: [ parseDOM: [
{ {
tag: "a[href]", tag: "a[href]",
priority: 100,
// TODO: untested // TODO: untested
getAttrs(dom) { getAttrs(dom) {
dom = dom as HTMLElement; dom = dom as HTMLElement;
const href = dom.getAttribute("href"); const href = dom.getAttribute("href");
if (href?.startsWith("/w/")) { if (
const matches = parse(routes.Page).pattern.exec(href); href &&
if (!matches) return false; /[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test(
href
)
) {
return { return {
id: matches[1], id: href,
}; };
} else return false; } else return false;
}, },