zestedesavoir / zmarkdown

Live demo: https://zestedesavoir.github.io/zmarkdown/
MIT License
224 stars 52 forks source link

Regarding package "remark-ping". Cannot set properties of undefined (setting 'ping') #488

Closed mambans closed 1 year ago

mambans commented 1 year ago

Hello, I'm wondering if anyone else have gotten this problem before? When I'm parsing the my html with "remark-ping" I get the following error "Cannot set properties of undefined (setting 'ping')".

const htmlTtext = <p><span class="mention" data-index="0" data-denotation-char="@" data-id="419" data-value="Robin Persson"><span contenteditable="false"><span class="ql-mention-denotation-char">@</span>Robin Persson</span></span> </p>;

export const htmlToMarkdown = () => {
    const file = remark()
        .use(rehypeParse, { emitParseErrors: true, duplicateAttribute: false })
        .use(rehypeRemark)
        .use(remarkPing, {
            pingUsername: (name) => true,
            userURL: (name) => https://your.website.com/path/to/${name},
        })
        .use(remarkStringify)
        .processSync(htmlText)
        .then((vfile) => {
            console.log("vfile:", vfile);
            return vfile;
        });

    return String(file);
};```

node: v18.7.0

"rehype-remark": "^9.1.2", "remark": "^14.0.2", "remark-html": "^15.0.2", "remark-ping": "^2.3.1", "remark-stringify": "^10.0.2",



![image](https://user-images.githubusercontent.com/23280380/235128608-14a778ea-e915-4136-a7ca-5745b843a186.png)
StaloneLab commented 1 year ago

Hello, the version of remark you are using is too recent for our plugins (more like our plugins being too old for the current version of remark). Please see issue https://github.com/zestedesavoir/zmarkdown/issues/416 , especially my latest message providing the key figures.

mambans commented 1 year ago

Ahh oke, thanks for the reply!