Vscode-markdown: Cannot print to HTML when another extension crashes

Created on 11 Oct 2020  ·  7Comments  ·  Source: yzhang-gh/vscode-markdown

Problem

What went wrong?

when I print document to html, console reports a err as follows:

ERR Cannot find module '@thomaskoppelaar/markdown-it-wikilinks'
Require stack:
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\MarkdownRenderingPlugin.js
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js:

and then, I can't find html in my current markdown file path

Expected behavior?

Print document to HTML successfully!

My environment

  • OS: Win 10
  • VS Code: 1.50.0
  • Plugins Version

    • Markdown All in One: 3.3.0

    • Markdown Notes: 0.0.20

How to reproduce

  1. open any markdown file and execute command Markdown All in One: Print current document to HTML
  2. click menu Help -> Toggle Developer Tools

err is shown in console

Error message in the console

ERR Cannot find module '@thomaskoppelaar/markdown-it-wikilinks'
Require stack:
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\MarkdownRenderingPlugin.js
- c:\Users\orangee\.vscode\extensions\kortina.vscode-markdown-notes-0.0.20\out\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js:
exporting Bug Fixed

All 7 comments

Thanks for the feedback.

The _Markdown Notes_ extensions uses a non-standard(?) way to extendMarkdownIt

https://github.com/kortina/vscode-markdown-notes/blob/431084cdae86891ab55cf01c8cb9983fcb377384/src/extension.ts#L70-L71

Not sure whether it matters 🤔

cc @1354092549 (in case you have some insights into this issue).

Does the Markdown Notes extensions work well when previewing?
It seems the error is reported by VSCode Extension Loader.
Is there more detailed stacktrace?

Just tried on my PC and it seems it is an issue of Markdown Notes (on its activation). We can still see the error message if we do nothing but open a Markdown file.

Does the Markdown Notes extensions work well when previewing?

I haven't used this extension before but from what I can see, it doesn't work in the VSCode's preview tab. (@orangee-wi)

Generally speaking, that extension is supposed to be shipped with markdown-it-wikilinks. But it doesn't:
https://github.com/kortina/vscode-markdown-notes/issues/101

It's okey to just add a try-catch block. And log may be needed.

What about:

// Skip the third-party Markdown extension, if it is broken or crashes.
try {
    md = await contribute.extendMarkdownIt(md);
} catch (err) {
    console.error(`Skipped Markdown extension: ${contribute.extensionId}\nBecause:\n${err}`);
}
Was this page helpful?
0 / 5 - 0 ratings