On linux
curl -L https://github.com/Eonm/markdown-packager/releases/latest/download/markdown-packager --output markdown-packager
chmod +x markdown-packager
sudo mv -u markdown-packager /usr/bin/
The pack
sub command allows you to embed files inside your markdown file.
markdown-packager -i input_file.md pack style.css metadata.yml -o output_file.md
External files
.yml
: The content of the external yaml file is added to the header of your markdown file..md
: The header of the external markdown document won't be added to your markdown file. The content of the .md file is appended at the end of your markdown file.
Other file formats are appended at the end of your markdown file.
Images
Images are embedded as base64 links. Remote images are downloaded before being embedded.
![Example image](./test/files/image.gif)
<!-- will be rendered as : -->
![Example image](data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH+EUNyZWF0ZWQgd2l0aCBHSU1QACwAAAAAAQABAAACAkQBADs=)
Images format
Supported image formats are :
- .gif
- .png
- .jpeg
- .svg
The link
sub command allows you to link images inside your markdown file. Remote images are downloaded before being linked.
markdown-packager -i input.md link -o output_file.md
![Example image](https://upload.wikimedia.org/wikipedia/commons/4/48/Markdown-mark.svg)
<!-- will be rendered as : -->
![Example image](./Markdown-mark.svg)
--image-dir
: This flag allows you to specify the destination and source folder for images. Remote images are downloaded in this directory.--download-mod
: Keep or erase existing images.--log
: Display useful informations.
Embed bibliographical references :
See how embeded references work : https://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html#inline_references
markdown-packager -i input_file.md pack my_bibliography.yaml -o output_file.md
pandoc output_file.md -o output_file.pdf -F pandoc-citeproc
Take a look at the full example.
Embed images :
markdown-packager -i input_file.md pack -o output_file.md
Stdin and Stdout :
Read content from stdin and write content to stdout.
cat input_file.md | markdown-packager pack > output_file.md