manuth / MarkdownConverter

Provides the functionallity to convert Markdown-files to html, png, or pdf using vscode.
MIT License
37 stars 11 forks source link

PDF export produces file with 404 error instead of text #61

Closed HughxDev closed 3 years ago

HughxDev commented 3 years ago

File just says:

404 The requested path could not be found

Markdown Coverter v3.1.2

VS Code Version: 1.51.1 Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f Date: 2020-11-11T01:11:34.018Z (3 wks ago) Electron: 9.3.3 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Darwin x64 19.6.0

manuth commented 3 years ago

Hello @hguiney Sadly I couldn't reproduce the issue. I just created a macOS VM in order to try it out and it's working fine for me. Could you please create a repository containing your markdown-workspace for me to reproduce the issue?

JoeJoeTV commented 3 years ago

I have the same Issue, it just shows a 404 error page.

Version: 1.52.1 Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523 Datum: 2020-12-16T16:32:10.090Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 Betriebssystem: Linux x64 5.4.0-60-generic

manuth commented 3 years ago

Thanks for confirming the error

Sadly I still wasn't able to find the reason for the error to occur. Are you working in a .code-workspace, a single directory or are you editing a single file when the error occurs?

damgot commented 3 years ago

Hello, same for me.

I've got a 404 pdf.

I'm using a single md file (no workspace or directory, just single file).

I tried older version (3.0.2), but I've got this error : An unexpected error occurred: TypeError: Cannot read property 'push' of undefined

And saw this error from multiple extension, do you know where it comes from ?

It's blocking for us. Thanks a lot

manuth commented 3 years ago

Sadly I still find myself unable to reproduce the error. I suspect the error must be somwhere here: https://github.com/manuth/MarkdownConverter/blob/a1824643e41863ad5e7820dca75fa1f11c4b8182/src/Conversion/Converter.ts#L177-L186

If the markdown-file with a leading .html is requested (for example /Test.md.html), the rendered document should be returned by the web server (the if-branch). But it looks like the code enters the else-branch which uses the server-handler package for loading files from the file-system for you guys who expire this issue.

Sadly I'm not quite sure what might be causing this issue.

@damgot do you think you're able to once more clone the code, add a breakpoint to line 177 and tell me contents of the variables request.url and this.WebDocumentName?

Thanks for being patient Kind regards

damgot commented 3 years ago

Hello, Unfortunattely, I'm not able to debug it. I've following errors :

Command 'Markdown: Convert Document' resulted in an error (command 'markdownConverter.Convert' not found)

Activating extension 'manuth.markdown-converter' failed: Cannot find module 'c:\Proj\MarkdownConverter\lib\index.js' Require stack: - c:\Users\Damgot\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js - c:\Users\Damgot\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-amd.js - c:\Users\Damgot\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js.

Do you know what is wrong ? Thanks

manuth commented 3 years ago

That's weird. Maybe the code failed to build before debugging...

damgot commented 3 years ago

I tried the extension without any options and it seems to work with very simple md file.

However, the image syntax "![alternate] (path to image)" seems no longer work.

The text is print in the pdf, instead of the image.

2021-02-15 15_23_35-Untitled-1 pdf - Adobe Acrobat Reader DC (32-bit)

FabianSchuster commented 3 years ago

Hey, I have nearly the same issue... In my case the error is just there when I include images.

Error: net::ERR_EMPTY_RESPONSE at http://localhost:46835/Markdown_template.md.html

When it comes to Text i have no issues About my system:

I hope i could help you!

damgot commented 3 years ago

Hello all, It seems it's not a bug with markdownConverter but with VSCode.

There are a lot of problem with image interpretation in markdown file with the last 1.53 vscode version. It seems downgrade to 1.52.1 solve the issue.

So @manuth , don't worry, the problem is not on your side.

manuth commented 3 years ago

@damgot thank you very much for pointing this out, that's very useful! @hguiney, @JoeJoeTV is your issue probably related to the inproper picture-handling as pointed out by @damgot?

manuth commented 3 years ago

I was able to find the issue (inside the markdown-language-features extension) which caused markdown-files containing pictures to throw errors.

I implemented a workaround which will be included in the upcoming version. Also I opened up an issue in the vscode-repository: https://github.com/microsoft/vscode/issues/116987

@hguiney, @JoeJoeTV please let me know whether your documents contains pictures and also check whether it's working properly using vscode 1.52.1.

richardy706 commented 3 years ago

I am having the same 404 issue when converting to PDF. My document does not have any images but does have fenced code blocks. Version: 3.1.2 VS Code: 1.56.2 Windows: 10.0.19042

damgot commented 3 years ago

Also have the bug with VS.Code 1.56.2.

It's a Visual Studio Code bug

damgot commented 3 years ago

Also : Please be sure to not use any special character in your md filename and/or folder name. The absolute path to the md filename need to have no accent at all.

manuth commented 3 years ago

Thanks für looking into the matter - I'll make sure to work on MarkdownConverter again as soon as I can

Sorry for letting you guys wait for so long

manuth commented 3 years ago

Also : Please be sure to not use any special character in your md filename and/or folder name. The absolute path to the md filename need to have no accent at all.

Thanks a ton for pointing this out! This helped me a lot to solve the issue.

I finally got some time left for working on the MarkdownConverter again.

Stay tuned