yhatt/marp

missing figures when running marp with --pdf

tosaba opened this issue · 4 comments

➡️  This issue is related to the new version (https://github.com/marp-team/marp-cli), but due to the lack of the issues option, I'm posting it here ...

I have been testing the marp-cli and also in that early stage it's already a very nice and promising tool.
There is one thing I came across when I run the client version with PDF option., i.e.

marp test.md --pdf 

Local figures (inline or background), which are linked with absolute or relative paths, are not shown in the PDF.

---
# New slide title

![](figure.png)

![bg](figure.png)

Inserting figures from the web works well, e.g.

---

# 1st slide with inline image

![](https://c2.staticflickr.com/2/1688/24269660074_b675f702d7_h.jpg)

---

# 2nd slide with background image

![bg](https://c2.staticflickr.com/2/1688/24269660074_b675f702d7_h.jpg)

---

In any case, the HTML output is just fine, no matter if local figures or online figures are being used.

Thanks

yhatt commented

Thanks you for testing the early Marp. We have not yet decided the strategy for tracking issues about Marp family. But it's ok to use yhatt/marp for a while.

Perhaps it comes from rendering HTML data by using URI scheme while converting into PDF.

https://github.com/marp-team/marp-cli/blob/bd6d29eb4f67838ae312bd59fc787f4a5069efb5/src/converter.ts#L69-L76

In this case, it has not defined base path to resolve relative path. We are going to try the HTML <base> element that might be helpful..

yhatt commented

We're trying to fix in marp-team/marp-cli#10 now. For security reasons, we would have to add --allow-local-files option to render local files.

We will let you know once it's released.

yhatt commented

@tosaba We have released @marp-team/marp-cli v0.0.6 it includes fix about reported issue. You would be able to render local figures in PDF correctly by passing --allow-local-files option.

Thanks a lot!