All Projects → jmaupetit → Md2pdf

jmaupetit / Md2pdf

Licence: mit
Markdown to PDF conversion tool

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Md2pdf

Pandoc Latex Template
A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
Stars: ✭ 3,750 (+4967.57%)
Mutual labels:  markdown, pdf-generation
C4 Builder
This is a documentation builder. You feed it .md and .puml and it exports a site, pdf, or a markdown with navigation.
Stars: ✭ 164 (+121.62%)
Mutual labels:  markdown, pdf-generation
Md To Pdf
Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
Stars: ✭ 374 (+405.41%)
Mutual labels:  markdown, pdf-generation
Markdown Pdf
📄 Markdown to PDF converter
Stars: ✭ 2,365 (+3095.95%)
Mutual labels:  markdown, pdf-generation
Mkdocs With Pdf
Generate a single PDF file from MkDocs repository.
Stars: ✭ 39 (-47.3%)
Mutual labels:  markdown, pdf-generation
Godot Engine.file Editor
A Godot Engine addon that adds a File Editor for multiple file types editing. Create and Write plain text files, configuration files and csv files with custom visualizers and previews. Also supports file translations!
Stars: ✭ 70 (-5.41%)
Mutual labels:  markdown
Markdown Toc
Generate a markdown TOC (table of contents) for a README or any markdown files, using remarkable. Used by assemble, verb, and lots of other projects on GitHub. API and CLI.
Stars: ✭ 1,185 (+1501.35%)
Mutual labels:  markdown
Starter Academic
🎓 Easily create a beautiful academic résumé or educational website using Hugo, GitHub, and Netlify
Stars: ✭ 1,158 (+1464.86%)
Mutual labels:  markdown
Nice Mail
💌 Nice Mail 是一款以 Markdown 为基础的邮件编辑器。
Stars: ✭ 69 (-6.76%)
Mutual labels:  markdown
Vue Showdown
📃 Use showdown as a vue component
Stars: ✭ 74 (+0%)
Mutual labels:  markdown
Markdownxiaoshujiang
markdownxiaoshujiang
Stars: ✭ 1,188 (+1505.41%)
Mutual labels:  markdown
Evermark
🐘 A command line tool for syncing markdown notes to Evernote
Stars: ✭ 72 (-2.7%)
Mutual labels:  markdown
Markdown Formatter
markdown formatter
Stars: ✭ 70 (-5.41%)
Mutual labels:  markdown
Enex Dump
Dump the content of .enex files, preserving attachements, some metadata and optionally converting notes to Markdown.
Stars: ✭ 73 (-1.35%)
Mutual labels:  markdown
Swift
Airbnb's Swift Style Guide.
Stars: ✭ 1,165 (+1474.32%)
Mutual labels:  markdown
Markdown widget
📖Rendering markdown by flutter!Welcome for pr and issue.
Stars: ✭ 74 (+0%)
Mutual labels:  markdown
Markdeck
presentations as code - author cool slide decks, text-only, offline-ready, collaborative
Stars: ✭ 1,159 (+1466.22%)
Mutual labels:  markdown
Taskell
Command-line Kanban board/task manager with support for Trello boards and GitHub projects
Stars: ✭ 1,175 (+1487.84%)
Mutual labels:  markdown
Vim Pencil
Rethinking Vim as a tool for writing
Stars: ✭ 1,186 (+1502.7%)
Mutual labels:  markdown
Jsx Pdf
Generate PDFs using JSX! 🎯
Stars: ✭ 71 (-4.05%)
Mutual labels:  pdf-generation

md2pdf logo

Convert Markdown files to PDF with styles.

Build Status Coverage Status

Installation

The easiest way to go is to use pip:

$ pip install md2pdf

Usage

As a CLI

Usage:
    md2pdf [options] INPUT.MD OUTPUT.PDF

Options:
    --css=STYLE.CSS

For example, try to generate the project documentation with:

$ md2pdf README.md README.pdf

Optionally, you may load an external style (restricted to CSS2):

$ md2pdf --css tests/resources/input.css README.md README.pdf

As a library

You can use md2pdf in your python code, like:

from md2pdf.core import md2pdf

md2pdf(pdf_file_path,
       md_content=None,
       md_file_path=None,
       css_file_path=None,
       base_url=None)

Function arguments:

  • pdf_file_path: output PDF file path
  • md_content: input markdown raw string content
  • md_file_path: input markdown file path
  • css_file_path: input styles path (CSS)
  • base_url: absolute base path for markdown linked content (as images)

With Docker

Install Docker

Pull the image:

$ docker pull jmaupetit/md2pdf

Now run your image:

$ docker run --rm -v $PWD:/app jmaupetit/md2pdf --css styles.css INPUT.MD OUTPUT.PDF

Troubleshooting on MacOSX

Ensure, Weasyprint is fully functional before using md2pdf. You will find installation instructions in the project documentation: https://weasyprint.readthedocs.io/en/latest/install.html

In a few words, here are the few steps you will need to follow:

$ brew install cairo pango gdk-pixbuf libxml2 libxslt libffi

Misc

Using custom fonts in styles

WeasyPrint does not support the @font-face property yet (see project issue 28). If you use want to use custom fonts, you should use system fonts and define them with the font-family CSS property, like:

font-family: 'Neutraface Condensed';

Note that you should only define one single custom font, not a substitution list.

Contributing

Hacking

Clone this project first:

$ git clone [email protected]:jmaupetit/md2pdf.git

Install it with its dependencies (ideally in a virtual environment):

$ cd md2pdf
$ python -m venv venv
$ source venv/bin/activate
(venv) $ pip install -r requirements-dev.txt
(venv) $ python setup.py develop

Running the test suite

To run the test suite with your active python version (virtual environment):

(venv) $ pytest

Lint the code via:

(venv) $ flake8

Release a new version

Upload a new release to PyPI:

$ python setup.py sdist bdist_wheel
$ twine upload dist/* --username 'johndoe' --password 'secret'

License

md2pdf is released under the MIT License. See the bundled LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].