Render local resources in converting PDF by --allow-local-files option #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will support rendering local resources in converting PDF by added
--allow-local-files
option. See yhatt/marp#242.So far, we have rendered the converted HTML through data URI while converting into PDF. It is secure and less file I/O, but cannot access to
file:///
scheme resources.By enabling this option, we will create a temporally HTML file and use to render. It has
file:///
scheme and can access to local files by reason of Same-Origin Policy.To resolve relative path in Markdown, we will add
<base>
element to template while converting PDF.Example
--pdf
--pdf --allow-local-files
For security reason, local file access is disabled by default. You have to specify option explicitly if you want to use local resources. You would see a warning on CLI when using the option.
You should never use
--allow-local-files
if you want to use marp-cli for purpose of server-side rendering. The exploited Markdown could access/leak unexpected server files.Especially
--html --allow-local-files
on a server is a nightmare!!😈 Worst case
An execution confirmed by user is OK at all (e.g. execute in your local terminal).