HTML, PDF Output
This feature is available from v2.0.0.
MMG supports HTML and PDF output. You can specify it using the --output-format
or -o
option.
--output-format html
: HTML output--output-format pdf
: PDF output--output-format as-is
: Output in the same format as the original file (default)
mmg foo.md --output-format pdf
You can also use it with the recursive option, and you can specify the style of HTML and PDF by adding the --css
option.
For easy styling, two themes, github-light
and github-dark
, are provided by default.
--css github-light
: GitHub Light style (default)--css github-dark
: GitHub Dark style--css YOUR_CSS_FILE.css
: Custom CSS file
mmg -r -o pdf --css github-dark
To generate HTMLs, MMG uses the markdown package for markdown files and the nbconvert package for jupyter notebook files. And when generating PDFs, it first converts to HTML and then converts to PDF.
Therefore, if you want to include HTML tags in markdown, you need to add the markdown
attribute to the HTML tag as follows so that the markdown package can work properly.
See Markdown in HTML Extension for details.
<div align="center" markdown>
Hello, world!
</div>