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: [
{
tag: "a[href]",
priority: 100,
// TODO: untested
getAttrs(dom) {
dom = dom as HTMLElement;
const href = dom.getAttribute("href");
if (href?.startsWith("/w/")) {
const matches = parse(routes.Page).pattern.exec(href);
if (!matches) return false;
if (
href &&
/[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test(
href
)
) {
return {
id: matches[1],
id: href,
};
} else return false;
},