Create PDFs from Markdown without pandoc
251
This repository provides a Dockerfile to convert Markdown files into PDF.
Supports the following features
INPUT
::: warning
*here be dragons*
:::
OUTPUT
<div class="warning">
<p><em>here be dragons</em></p>
</div>
INPUT
@startuml
Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok
@enduml
OUTPUT

Include markdown fragment files: :[alternate-text](relative-path-to-file.md).
├── [plugins]
│ └── README.md
├── CHANGELOG.md
└── README.md
INPUT
README Content
:[Plugins](./plugins/README.md)
:[Changelog](CHANGELOG.md)
OUTPUT
Content of README.md
Content of plugins/README.md
Content of CHANGELOG.md
Download the image from Docker Hub. Then set the environment variables and link your markdown files into the container. The ouput files should appear in the folder.
Example for Project Folder
├── [folder_1]
│ └── README.md
│ └── README_APPENDIX.md
├── CHANGELOG.md
└── README.md
docker run --rm -v ./CHANGELOG.md:/data/CHANGELOG.md -e INPUT_FILE=/data/CHANGELOG.md blackrose01/markdown-pdfdocker run --rm -v ./folder_1:/data -e INPUT_FILE=/data/README.md blackrose01/markdown-pdfDEBUGDefault Value: false
Enables the debugging mode of the program.
CHROMIUM_PATHDefault Value: /usr/bin/chromium-browser
Path to the executable of Chromium. Normally this does not need to be adjusted.
CHROMIUM_ARGSDefault Value: --lang=en,--no-sandbox,--disable-setuid-sandbox
Arguments which will be passed to Chromium via Pupeteer.
INPUT_FILEName of the Input file which needs to be converted. This is a required.
OUTPUT_FILE_NAMEName of the Output file. Default is the name of the Input File.
OUTPUT_FILE_NAME_USE_FOLDERNAMEDefault Value: true
File name is the name of the parent folder in which the file is located. This option overwrites OUTPUT_FILE_NAME.
OUTPUT_FILE_NAME_CASE_STYLEDefault Value: capital Options: camel, capital, constant, dot, kebab, no, pascal, pascalsnake, path, sentence, snake, train
Name of the Output file. Default is the name of the Input File.
OUTPUT_TYPEDefault Value: pdf Options: pdf, html, png, jpeg, all
Determines the output format for the converter. If the all option is selected, all output formats are used.
OUTPUT_PATHSpecifies where the generated files are to be stored. The default is where the files to be converted are located.
ENABLE_SYNTAX_HIGHLIGHTDefault Value: true
Enables syntax highlighting.
HIGHLIGHT_STYLEDefault Value:
Options:
- 1c-light.css \
- a11y-dark.css \
- a11y-light.css \
- agate.css \
- androidstudio.css \
- an-old-hope.css \
- arduino-light.css \
- arta.css \
- ascetic.css \
- atom-one-dark.css \
- atom-one-dark-reasonable.css \
- atom-one-light.css \
- brown-paper.css \
- brown-papersq.png \
- codepen-embed.css \
- color-brewer.css \
- dark.css \
- default.css \
- devibeans.css \
- docco.css \
- far.css \
- felipec.css \
- foundation.css \
- github.css \
- github-dark.css \
- github-dark-dimmed.css \
- gml.css \
- googlecode.css \
- gradient-dark.css \
- gradient-light.css \
- grayscale.css \
- hybrid.css \
- idea.css \
- intellij-light.css \
- ir-black.css \
- isbl-editor-dark.css \
- isbl-editor-light.css \
- kimbie-dark.css \
- kimbie-light.css \
- lightfair.css \
- lioshi.css \
- magula.css \
- mono-blue.css \
- monokai.css \
- monokai-sublime.css \
- night-owl.css \
- nnfx-dark.css \
- nnfx-light.css \
- nord.css \
- obsidian.css \
- panda-syntax-dark.css \
- panda-syntax-light.css \
- paraiso-dark.css \
- paraiso-light.css \
- pojoaque.css \
- pojoaque.jpg \
- purebasic.css \
- qtcreator-dark.css \
- qtcreator-light.css \
- rainbow.css \
- routeros.css \
- school-book.css \
- shades-of-purple.css \
- srcery.css \
- stackoverflow-dark.css \
- stackoverflow-light.css \
- sunburst.css \
- tokyo-night-dark.css \
- tokyo-night-light.css \
- tomorrow-night-blue.css \
- tomorrow-night-bright.css \
- vs.css \
- vs2015.css \
- xcode.css \
- xt256.css
Which syntax highlighter should be used.
ENABLE_LINE_BREAKSDefault Value: true
Enable line breaks in documents.
<div class="page" />
ENABLE_EMOJISDefault Value: true
Enable Emojis in Markdown.
SCALEDefault Value: 1
Scaling for the document
PDF_RANGEDDefault Value:
Only save specific pages in PDF document. Example: 1, 2-5, 9
DISPLAY_HEADER_FOOTERDefaul Value: true
Print a header and a footer on each page in PDF.
HEADER_TEMPLATEDefault Value: <div style='font-size: 9px; margin-left: 1cm;'> <span class='title'></span></div> <div style='font-size: 9px; margin-left: auto; margin-right: 1cm;' >%%ISO-DATE%%</div>
Template for the Header.
FOOTER_TEMPLATEDefault Value: <div style='font-size: 9px; margin: 0 auto;'> <span class='pageNumber'></span> / <span class='totalPages'></span></div>
Template for the Footer.
PRINT_BACKGROUNDDefault Value: true
Print the background.
OMIT_BACKGROUNDDefault Value: true
Omit the background.
ORIENTATIONDefault Value: portrait Available Options: portrait, landscape
Orientation of the pages.
PAPER_FORMATDefault Value: A4 Available Options: A0, A1, A2, A3, A4, A5, A6, Ledger, Tabloid, Legal, Letter
Format of the pages.
PAPER_WIDTHWidth of a page. Overwrites environment variable PAPER_FORMAT.
PAPER_HEIGHTHeight of a page. Overwrites environment variable PAPER_FORMAT.
PAPER_MARGIN_TOPDefault Value: 1.5cm
Border margin top. Usable with unit.
PAPER_MARGIN_RIGHTDefault Value: 1cm
Border margin right. Usable with unit.
PAPER_MARGIN_BOTTOMDefault Value: 1cm
Border margin bottom. Usable with unit.
PAPER_MARGIN_LEFTDefault Value: 1cm
Border margin left. Usable with unit.
PLANTUML_OPEN_MARKERDefault Value: @startuml
Open marker for PlantUML containers.
PLANTUML_CLOSE_MARKERDefault Value: @enduml
Close marker for PlantUML containers.
PLANTUML_URLDefault Value: http://www.plantuml.com/plantuml
URL for PlantUML parser files.
MERMAID_URLJS file for Mermaid parser file.
ENABLE_MARKDOWN_IT_INCLUDEDefault Value: true
Enable inclusions of Markdown files.
MARKDOWN_IT_REGEX_INCLUDEDefault Value:
:\\[.+\\]\\((.+\\..+)\\)
Define the pattern of the include links in a markdown file.
JPEG_QUALITYDefault Value: 100
Quality of the JPEG file. Only for OUTPUT_TYPE jpeg.
IMAGE_CLIP_XX-Coordinate for clipper.
IMAGE_CLIP_YY-Coordinate for clipper.
IMAGE_CLIP_HEIGHTHeight of the Image from clipper.
IMAGE_CLIP_WIDTHWidth of the Image from clipper.
INCLUDE_DEFAULT_STYLESDefault Value: true
Include default CSS styles.
ADDITIONAL_STYLESList of local additional css files. Use absolute path in container.
.emoji {
height: 2em;
}
If you always want to output to the relative path directory from the Markdown file.
For example, to output to the "output" directory in the same directory as the Markdown file, set it as follows.
"markdown-pdf.outputDirectory" : "output",
"markdown-pdf.outputDirectoryRelativePathFile": true,
Please use the following to insert a page break.
<div class="page" />
This project uses the MIT license.
This repository based on yzanes VSCode extension Markdown PDF.
Content type
Image
Digest
sha256:9b8c10072…
Size
333.3 MB
Last updated
about 2 years ago
docker pull blackrose01/markdown-pdf