datahub
datahub copied to clipboard
[help]: Cannot read properties of undefined (reading 'data') remark-wiki-link
I really love this project so much. This is awesome work!!!
But i have some issue:
Cannot read properties of undefined (reading 'data')
at Object.exitWikiLink (file:///D:/Project/Pkmer/thino-landpage/node_modules/.pnpm/@[email protected]/node_modules/@portaljs/remark-wiki-link/dist/index.js:350:35)
at compile (file:///D:/Project/Pkmer/thino-landpage/node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:337:40)
at fromMarkdown (file:///D:/Project/Pkmer/thino-landpage/node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:173:27)
at parser (file:///D:/Project/Pkmer/thino-landpage/node_modules/.pnpm/[email protected]/node_modules/remark-parse/lib/index.js:33:12)
at Function.parse (file:///D:/Project/Pkmer/thino-landpage/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:668:12)
at executor (file:///D:/Project/Pkmer/thino-landpage/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:734:40)
at new Promise (<anonymous>)
I try to log, wikilink is undefined:
Then i go to see the exit
function:
In the remark-wiki-link package, I found that my code were giving me errors, and after checking that wikilink was returning undefined, I returned the node, and it worked. I don't know if this is a problem, or if something is wrong. I'm not sure if this is a problem or what's wrong.
Thx for any reply!
This issue might be caused by the version 2.0 of mdast-util-from-markdown. https://github.com/syntax-tree/mdast-util-from-markdown/commit/18f4bb0f1b720fd30f1c3a7b11e1fac90aa6903f
I also started experiencing this issue in my Astro site after upgrading from Astro 3 -> 4. According to their docs, it looks like they upgraded the following packages:
- unified
- remark
- rehype
Potentially this is an error with this package not being compatible with the latest version of one or more of these dependencies?
Since this.exit
no longer has a return value, I made the following modifications in my self-maintained version. Currently, it works in my use case, but it is unclear if there are any other issues. Can someone raise a PR to fix this issue?
fromMarkdown.ts#L76C3-L76C3
const wikiLink = top(this.stack)
const {
data: {isEmbed, target, alias},
} = wikiLink;
this.exit(token);
I am also experiencing this issue! I'll try out @yuhangch's solution against my use case, but I'm also unsure if I will be able to to put up a PR.
Add @yuhangch 's modification to exitWikiLink
function in remark-wiki-link/dist/index.js
works! 👍