Vscode-markdown: "Print to HTML" can be called on non-Markdown editor and cause error

Created on 11 Jun 2018  Â·  22Comments  Â·  Source: yzhang-gh/vscode-markdown

What is the problem?

Print current document to HTML fails and gives error.

How can I reproduce it?

Make a Markdown file and try to print it to HTML

Is there any error message in the console? (from menubar -> Help -> Toggle Developer Tools)

Error: Running the contributed command:'markdown.extension.printToHtml' failed.
     at e._executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:674:709)
     at e.$executeContributedCommand (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:675:6)
     at e._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:636:832)
     at e._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:636:550)
     at e._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:631)
     at e._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:400)
     at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:634:315
     at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:637:395
     at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:95:432
     at e.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:96:764)
     at Socket. (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:154:338)
     at emitOne (events.js:96:13)
     at Socket.emit (events.js:191:7)
     at readableAddChunk (_stream_readable.js:178:18)
     at Socket.Readable.push (_stream_readable.js:136:10)
     at Pipe.onread (net.js:560:20)

Bug Needs TagFix Fixed

All 22 comments

This error message seems not to tell us why it failed. Could you please download the latest CI build and try to print again? (You can find the download link at the end of README.md)

Sure, what exactly do I do with the .vsix file once downloaded?

image

That worked! Thanks so much!

I don't know why installing from the .vsix file works, but when I uninstalled the extension and re-installed it through the marketplace, it gave me an error.

I also have no idea... but I will leave this issue open to see whether there are other people seeing this error.

After installing from the .vsix file, my my bold lines have changed.

If the line ends in a period, it stays orange as it did before. But now when there is no period, the surrounding stars are grey and the text it white.

Is this an error or on purpose?

image

This is a working-in-progress feature and I haven't added an option to enable/disable it.

To disable this, you can navigate to [your user home]/.vscode/extensions/yzhang.markdown-all-in-one-1.4.0/out/extension.js and comment out line 33 decorations.activiate(context);

Related #185.

Ah, very neat!

I'm looking forward to see if this is something i'd use or not.

Hi there, I'm having the same issue. It was working fine up until a few days ago. I tried installing the plugin from the .vsix file but I am still getting a similar error. Here is my debug output:

Error: Running the contributed command:'markdown.extension.printToHtml' failed. at e._executeContributedCommand (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:674:709) at e.$executeContributedCommand (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:675:6) at e._doInvokeHandler (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:636:832) at e._invokeHandler (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:636:550) at e._receiveRequest (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:631) at e._receiveOneMessage (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:635:400) at d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:634:315 at d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:637:395 at d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:95:432 at e.fire (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:96:764) at Socket.<anonymous> (d:\Program Files\Microsoft_VS_Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:154:338) at emitOne (events.js:96:13) at Socket.emit (events.js:191:7) at readableAddChunk (_stream_readable.js:178:18) at Socket.Readable.push (_stream_readable.js:136:10) at Pipe.onread (net.js:560:20)

Still no more information with this error log. What's your Markdown file extension? .md? or something else?

It's definitely .md. I've tried exporting to HTML for a file that I was
able to previously and it no longer works.

On Thu, Jun 14, 2018 at 1:07 PM, Yu Zhang notifications@github.com wrote:

Still no more information with this error log. What's your Markdown file
extension? .md? or something else?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/neilsustc/vscode-markdown/issues/205#issuecomment-397135111,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AUDbT_W0o-weIhGGg0k61LwCLy6XSXrGks5t8bdNgaJpZM4UiRjt
.

I have packaged a debug build markdown-all-in-one-1.4.0-debug.zip.

Could you install this one and try to print again, then tell me the debug output?

Sure, I won't be able to test it for a few hours I'm afraid. I'll let you
know how it goes.

On Thu, Jun 14, 2018 at 1:24 PM, Yu Zhang notifications@github.com wrote:

I have packaged a debug build markdown-all-in-one-1.4.0-debug.zip
https://github.com/neilsustc/vscode-markdown/files/2100458/markdown-all-in-one-1.4.0-debug.zip
.

Could you install this one and try to print again, then tell me the debug
output?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/neilsustc/vscode-markdown/issues/205#issuecomment-397137458,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AUDbT3IrQhyG63Mpq3Z18W_XjMmArtQ8ks5t8btDgaJpZM4UiRjt
.

I also had the same error with the latest regular vsvcode version. I now tried your debug build of the extension from above and it works with that.

After .vsix plugin installation, my issue was fixed. But I also have returned from my work place, where I have a restricted and very slow internet access. Does your extension use any online tools to print an HTML from a MD?

No, it should be offline. The only thing that needs network is the math rendering if you open the HTML in the browser. The printing process itself doesn't require internet access and should be fast.

I was encountering the same issue on Windows with the latest VS Code. Updating to the latest CI Build fixed the issue.

I'm getting this error in Log:

[2018-06-22 18:51:04.797] [exthost1] [error] TypeError: Cannot read property 'fromHeading' of undefined at Object.slugify (/home/akashj/.vscode/extensions/yzhang.markdown-all-in-one-1.4.0/out/src/util.js:47:30) at slugify (/home/akashj/.vscode/extensions/yzhang.markdown-all-in-one-1.4.0/out/src/print.js:25:33) at Object.md.renderer.rules.heading_open (/usr/share/code/resources/app/extensions/markdown-language-features/node_modules/markdown-it-named-headers/index.js:29:16) at Renderer.render (/usr/share/code/resources/app/extensions/markdown-language-features/node_modules/markdown-it/lib/renderer.js:326:38) at MarkdownIt.render (/usr/share/code/resources/app/extensions/markdown-language-features/node_modules/markdown-it/lib/index.js:543:24) at render (/home/akashj/.vscode/extensions/yzhang.markdown-all-in-one-1.4.0/out/src/print.js:102:15) at print (/home/akashj/.vscode/extensions/yzhang.markdown-all-in-one-1.4.0/out/src/print.js:54:16) at context.subscriptions.push.vscode.commands.registerCommand (/home/akashj/.vscode/extensions/yzhang.markdown-all-in-one-1.4.0/out/src/print.js:30:106) at e._executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:674:613) at e.$executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:675:6) at e._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:636:832) at e._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:636:550) at e._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:635:631) at e._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:635:400) at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:634:315 at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:637:395 at /usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:95:432 at e.fire (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:96:764) at Socket.<anonymous> (/usr/share/code/resources/app/out/vs/workbench/node/extensionHostProcess.js:154:338) at emitOne (events.js:96:13) at Socket.emit (events.js:191:7) at readableAddChunk (_stream_readable.js:178:18) at Socket.Readable.push (_stream_readable.js:136:10) at Pipe.onread (net.js:560:20) markdown.extension.printToHtml

I am encountering the same issue.

There will be a new version several hours later.

Running the contributed command:'markdown.extension.printToHtml' failed. error happens when I execute the Markdown: Print current to HTML command if only [Preview] window open. Otherwise it works. On v1.5.1 (Win10 x64)

Good catch. Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akurani picture akurani  Â·  4Comments

akshaybabloo picture akshaybabloo  Â·  3Comments

MisterY picture MisterY  Â·  3Comments

nosalan picture nosalan  Â·  3Comments

deanishe picture deanishe  Â·  4Comments