But it's not elegant, could you pls add one line to initialize it?
// e.renderer.rules.image=(e,n,r,i,o)=>{const s=e[n];s.attrJoin("class","loading");const l=s.attrGet("src");if(l){i.containingImages.push({src:l});const e=a.hash(l);s.attrSet("id","image-hash-"+e)}return t?t(e,n,r,i,o):o.renderToken(e,n,r,i,o)}
e.renderer.rules.image = (e, n, r, i, o) => {
const s = e[n];
s.attrJoin("class", "loading");
const l = s.attrGet("src");
if (l) {
// add this line
if(!i.containingImages) i.containingImages=[];
i.containingImages.push({
src: l
});
const e = a.hash(l);
s.attrSet("id", "image-hash-" + e)
}
return t ? t(e, n, r, i, o) : o.renderToken(e, n, r, i, o)
}
Steps to Reproduce:
env.containingImages
, which is initialized in preview featuremarkdownit.render
other places withoutenv.containingImages
, it crashesthat's why this issue happens: https://github.com/qjebbs/vscode-markdown-extended/issues/98
and I temporarily fix it with: https://github.com/qjebbs/vscode-markdown-extended/commit/e68b60a1e08cb5602e7a7a6705e91d8094ea9fb5
But it's not elegant, could you pls add one line to initialize it?