tkubec / MarkdownToPdf

.NET library serving as a converter of markdown text to PDF, supporting fully customizable styling and plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MarkdownToPdf Library

MarkdownToPdf is a .NET library serving as a converter of markdown text to PDF. It supports fully customizable styling via cascading styles, page setup, headers and footers, page numbering, sections, page and sections breaks and it also supports plugins for features like syntax highlighting or for displaying mathematical expressions. Technically it uses markdig library to parse the markdown document an Pdfsharp/Migradoc library to render the output.

Supported markdown flavors and extensions

  • basic and github markdown
  • Pipe tables
  • Grid tables
  • Extra emphasis (strike through ~~,Subscript ~ Superscript ^ Inserted ++ Marked ==)
  • Special attributes for applying styles and formatting
  • Footnotes
  • Task Lists
  • Citation text by enclosing ""...""
  • Custom containers similar to fenced code block :::
  • Mathematics/Latex extension by enclosing $$ for block and $ for inline math
  • SmartyPants

For details, see markdig documentation and this project documentation.

Basic Usage

The basic usage is pretty straightforward:

  • create an instance of MarkdownToPdf
  • optionally set-up the page layout
  • optionally modify or add styles
  • add the markdown text
  • save

E.g.:

var pdf = new MarkdownToPdf();

pdf
    .Add("# Hello, Wolrd")
    .Save("output.pdf");

Please see the documentation for more information. Here are some sample PDF outputs:

Installation

The library is available as a NuGet package:

Plugins

Syntax highlighter

MarkdownToPdf.SyntaxHighlighter based on PrismSharp currently supports over 270 programming languages and has 44 built in visual themes

License

This software is released under the MIT license.

About

.NET library serving as a converter of markdown text to PDF, supporting fully customizable styling and plugins


Languages

Language:C# 100.0%Language:Batchfile 0.0%