Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdpdf console command fails on windows if the markdown file is within a folder that has a pound sign (#) #164

Open
futuremotiondev opened this issue Dec 24, 2023 · 1 comment

Comments

@futuremotiondev
Copy link

Command:
mdpdf "D:\Dev\00 Research\C#\C# Cheat Sheet.md" --style C:\bin\github.css

Error:

12-24 03:49:32 C:\Users\username\Desktop> mdpdf "D:\Dev\00 Research\C#\C# Cheat Sheet.md" --style C:\bin\github.css
Error: net::ERR_FILE_NOT_FOUND at file:D:\Dev\00 Research\C#\_temp.html
    at navigate (C:\Users\username\AppData\Roaming\nvm\v20.10.0\node_modules\mdpdf\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:194:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FrameManager.navigateFrame (C:\Users\username\AppData\Roaming\nvm\v20.10.0\node_modules\mdpdf\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:170:21)
    at async Frame.goto (C:\Users\username\AppData\Roaming\nvm\v20.10.0\node_modules\mdpdf\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:589:16)
    at async Page.goto (C:\Users\username\AppData\Roaming\nvm\v20.10.0\node_modules\mdpdf\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1089:16)
    at async C:\Users\username\AppData\Roaming\nvm\v20.10.0\node_modules\mdpdf\src\index.js:174:7

Despite the error stating ERR_FILE_NOT_FOUND at file:D:\Dev\00 Research\C#\_temp.html, _temp.html IS actually created in the target folder. But node seems unable to find it?

Hopefully this is an easy fix.

@elliotblackburn
Copy link
Owner

Hey, thanks for reporting this. It looks like the error is coming from the Puppeteer call to get chrome to navigate to the intermediary html file. I'm not entirely sure why Chrome would be unhappy with that path. I imagine it's because the result of the resolve call to get the file path isn't quite fit for a URL on windows. Looking at that URL, it looks like it's missing some prefix /'s at least.

Unfortunately I don't have access to a windows machine which I can install nodejs on at the moment as I only use linux and macos these days. If that changes I'll give this a crack but I can't promise anything any time soon.

If you'd like to open a PR, I'd be more than happy to review and merge. I suspect the change will be somewhere around https://github.com/BlueHatbRit/mdpdf/blob/01f2e38e1e85b0839de3c89d0d24c18b20aae5fa/src/index.js#L175 where we get the file path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants