-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
PDF export does not render math from marp-vscode; works from marp-CLI #119
Comments
As you said the conversion is really outsourced to Marp CLI so I feel weird it too. Unfortunately I could not reproduce the failure of rendering maths in PDF export via VS Code extension. Could you show me a minimum Markdown example to reproduce it? |
Actually this might turn out to be an issue also for marp-cli because now I'm getting the same non-rendering with the CLI (not sure why it worked once via the CLI) . Here is a minimal example. Here is markdown for a single slide (in a file called
The marp-preview in vscode renders the math correctly. Here is a screenshot: However, now the exported PDF doesn't render the equations between $$ either whether produced via 'Export Slide Deck' is vscode or now from the CLI via: Here is a screenshot of how it looks on the PDF: These slides used to export fine from the old marp executable. Thanks for your help. |
Thanks for the details. At a glance, the screenshot of the output looks like getting similar trouble about auto-scaling like marp-team/marp-cli#168. (Marp Core has enabled auto-scaling for math block and code block in built-in themes, powered by JavaScript) I've confirmed a similar rendering result when opening an exported slide in HTML with disabled JavaScript. However, I cannot be assumed that the execution of the script is disabled randomly while rendering. 🤔 |
Thanks for identifying the problem. Is there any workaround that you can suggest at this point, or is it something that needs a fix? Can I switch to manual scaling in a custom theme somehow? (Sorry, I don't have a very deep understanding of how the whole system works.) |
The workaround is using custom theme with /*
* @theme custom-theme
* @auto-scaling false
*/
@import 'default';
.katex-display {
/* Scale down font size of math block if necessary */
/* font-size: 80%; */
} ---
marp: true
theme: custom-theme
---
... |
Thank you, I was a bit unsure about how to build this custom theme but I see instructions here. Would this work?
At this point the content of my Pslides.code-workspace file is:
I tried the above but I'm still not seeing the math render on the PDF. |
The theme name is |
Thank you. Now it's working and I see the ease and power of custom themes! Let me summarize in closing for anybody who might want to setup a custom theme using the A suggestion: It might be useful to expand the short instructions on the vscode-marp extension page here to make these steps more apparent to a broader audience. |
Sorry to open this issue again but I wanted to report that the original issue: "PDF export does not render math from marp-vscode; works from marp-CLI" actually remains true. The custom-theme workaround (above) allows PDF conversion to render math correctly via the CLI but it does not appear to have fixed export from vscode (even after adjusting settings as described above). This leads me to a related question. When I convert from the CLI e.g.
the conversion process takes quite some time as it seems to be extracting node modules and building the Now that I'm getting the hang of it, I'm loving the power of marp to create customizable markdown slideshows for my teaching. I don't mind conversion via the CLI but it would be great to have the vscode export button working to speed workflow even more. Thanks! |
Unfortunatelly Marp team cannot still reproduce your issue, and we are not recieved the report from other users too. Thus, I suppose it's a environment specific problem. I think the most likely cause is JavaScript disabled Google Chrome. Marp will convert Markdown into PDF through Google Chrome so the output will be incorrect if the script execution for the local file was disabled or restricted by some reason (e.g. Chrome is managed by enterprise for security). Please try to export into HTML, and check whether the outputted HTML has the correct math rendering by opening it in your Chrome. npx is the easiest way to run the latest Marp CLI through user's Node.js, but it fetches Marp CLI and dependent modules from remote in each time so it would take a lot of time. If you expect to use Marp CLI many times, we recommend to install Marp for VS Code extension has already included Marp CLI module and dependent packages so it's faster than |
Your guess appears to be correct The export from vscode works from my home computer without problems. It is only from my Windows PC at work, which like is 'managed by enterprise,' where the math scaling doesn't work from vscode (but does work from the CLI). Thank you for pointing me to the marp executable, it speeds things up a lot. |
When I convert a math-heavy markdown file to PDF via marp-cli eveything works fine.
However, when I attempt to do convert the same file from Marp for vs-code using the convenient
export slide deck
option the resulting PDF fails to render most of the math blocks (i.e. any math such as$$ x^2$$
in the markdown.. although the inline$x^2$
seem to work). I just get empty space where the equations should be.It's not much trouble for me to work via the marp-cl, but this seemed a curious thing since I saw you say somewhere that the conversions are in fact outsourced to marp-cli. Any thoughts?
Thanks for an awesome extension.
my setup:
Windows 10
VS code 1.41.1
Marp extension 0.12.0
The text was updated successfully, but these errors were encountered: