https://github.com/opf/md-to-pdf
A markdown to pdf generator with styling by yml
https://github.com/opf/md-to-pdf
markdown pdf
Last synced: 7 months ago
JSON representation
A markdown to pdf generator with styling by yml
- Host: GitHub
- URL: https://github.com/opf/md-to-pdf
- Owner: opf
- License: gpl-3.0
- Created: 2022-10-25T09:52:55.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-19T10:54:58.000Z (7 months ago)
- Last Synced: 2025-06-22T00:57:49.485Z (7 months ago)
- Topics: markdown, pdf
- Language: Ruby
- Homepage:
- Size: 4.86 MB
- Stars: 9
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Markdown-to-PDF
A markdown to pdf generator with styling by yml.
**WORK IN PROGRESS**, please expect changes to API and styling yml spec
## Installation
```bash
bundle add md_to_pdf --github opf/md-to-pdf
```
Requirements
* Ruby 3.4.0 or newer
## Usage
### Command line
bundle exec md_to_pdf `` `` ``
Example:
```bash
bundle exec md_to_pdf ./demo/demo.yml ./demo/demo.md ./demo/generated/demo.pdf
```
### As Library
```ruby
require 'md_to_pdf'
#...
# file processing
styling_filename = './demo/demo.yml'
source_filename = './demo/demo.md'
dest_filename = './demo/generated/demo.pdf'
MarkdownToPDF.generate_markdown_pdf(source_filename, styling_filename, dest_filename)
# example with raw markdown pre-processing
markdown_string = File.read(source_filename)
markdown_string += 'An additional text at the bottom'
images_path = File.dirname(source_filename)
MarkdownToPDF.generate_markdown_string_pdf(markdown_string, styling_filename, images_path, dest_filename)
```
## Known Limitations
* Table cells that exceed the height of a single page are truncated (see [prawn-table#41](https://github.com/prawnpdf/prawn-table/issues/41)).
**Currently not supported:**
* Tables in tables
* Images inline in text in tables (images will be placed in own line)
* Images inline in text (images will be placed in own line)
* Remote images e.g. via http (images will be skipped)
* Outer table borders at the same time as cell borders of outer cells
## Markdown
Please have a look at [demo.md](./demo/demo.md) for an overview and examples of all supported markdown syntax
## Styling
A yml config file is used to set the pdf styling
Please have a look at [docs/STYLING.md](docs/STYLING.md) for description.
## Frontmatter
Meta Information and header/footer content is defined in a head section of the markdown file
Please have a look at [docs/FRONTMATTER.md](docs/FRONTMATTER.md) for description.