MdToPptx 2.0.1

Additional Details

We have discontinued the support for this project.

dotnet add package MdToPptx --version 2.0.1
                    
NuGet\Install-Package MdToPptx -Version 2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MdToPptx" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MdToPptx" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MdToPptx" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MdToPptx --version 2.0.1
                    
#r "nuget: MdToPptx, 2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MdToPptx@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MdToPptx&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MdToPptx&version=2.0.1
                    
Install as a Cake Tool

MdToPptx

A .NET 8 library that converts Markdown text to OpenXML PowerPoint (PPTX) elements. Parse your Markdown once, get properly formatted paragraphs, lists, tables, and inline styles ready to insert into any PPTX slide — with automatic multi-slide pagination when content overflows.

Supported Markdown Features

Feature Markdown Syntax PPTX Rendering
Bold **text** Bold run property
Italic *text* Italic run property
Bold + Italic ***text*** Both properties
Inline code `code` Monospace font + highlight
Links [text](url) Underlined, colored, clickable hyperlink
Headings (H1-H6) # Heading Scaled font size + bold
Bullet lists - item Character bullet with indent
Numbered lists 1. item Auto-numbered bullet
Nested lists Indented items Increasing indent levels
Tables Pipe tables A.Table with borders and header styling
Block quotes > text Italic with left indent

Installation

Add the NuGet package to your project (once published), or reference the project directly:

dotnet add reference path/to/src/MdToPptx/MdToPptx.csproj

Dependencies

Quick Start

Creating a Multi-Slide PPTX from Scratch

Use AddToSlides to automatically paginate content across multiple slides when it exceeds the usable area:

using MdToPptx;
using MdToPptx.Helpers;

var markdown = """
    # Quarterly Report
    Revenue increased by **15%** compared to last quarter.

    | Metric | Q1 | Q2 |
    | --- | --- | --- |
    | Revenue | $2.0M | $2.3M |

    ## Highlights
    - Launched **new enterprise tier**
    - Expanded into *3 new markets*

    For details, visit [the dashboard](https://example.com).
    """;

using var doc = PresentationBuilder.CreatePresentation("output.pptx", widescreen: true);

var converter = new MarkdownToPptxConverter(new ConversionOptions
{
    DefaultFontSize = 1400,  // 14pt
});

// Automatically creates as many slides as needed
List<SlidePart> slides = converter.AddToSlides(doc, markdown);

doc.Save();
Console.WriteLine($"Created {slides.Count} slide(s)");

Adding Markdown to a Single Slide

If you already have a slide and want to add content to it (no auto-pagination):

using var doc = PresentationBuilder.CreatePresentation("output.pptx");
var slidePart = PresentationBuilder.AddBlankSlide(doc);

var converter = new MarkdownToPptxConverter();
converter.AddToSlide(slidePart, markdownText);

doc.Save();

Get Paragraphs for an Existing Text Body

var converter = new MarkdownToPptxConverter();
var paragraphs = converter.ConvertToParagraphs("**Hello** *world*");

// Append to any TextBody (shape, table cell, etc.)
foreach (var p in paragraphs)
{
    textBody.AppendChild(p);
}

Get Raw Elements for Custom Layout

var elements = converter.ConvertToSlideElements(markdownText);

// elements is a List<OpenXmlElement> containing:
//   - A.Paragraph for text/headings/lists
//   - A.Table for tables (wrap in GraphicFrame for slide placement)

Append Directly to a TextBody

var converter = new MarkdownToPptxConverter();
converter.AppendToTextBody(existingTextBody, markdownText);

Customization

Pass a ConversionOptions object to control styling:

var converter = new MarkdownToPptxConverter(new ConversionOptions
{
    DefaultFontFamily = "Arial",
    CodeFontFamily = "Fira Code",
    DefaultFontSize = 1600,            // 16pt (value is in hundredths of a point)
    DefaultFontColor = "333333",       // dark gray
    LinkFontColor = "1A73E8",          // Google blue
    CodeFontColor = "D63384",          // pink
    CodeHighlightColor = "F8F9FA",     // light background
    HeadingBold = true,
    HeadingFontColor = "1F2937",
    HeadingFontSizes = new Dictionary<int, int>
    {
        { 1, 3600 },  // 36pt
        { 2, 3000 },  // 30pt
        { 3, 2400 },  // 24pt
        { 4, 2000 },  // 20pt
        { 5, 1800 },  // 18pt
        { 6, 1600 },  // 16pt
    },
    BulletChar = "\u2022",             // bullet character
    ListIndentPerLevel = 457200,       // 0.5 inch per indent level
    ParagraphSpaceBefore = 400,
    ParagraphSpaceAfter = 400,
    TableBorderColor = "D1D5DB",
    TableHeaderBackground = "F3F4F6",
    TableBorderWidth = 12700,          // 1pt
});

API Reference

MarkdownToPptxConverter

Method Returns Description
AddToSlides(PresentationDocument, string, ...) List<SlidePart> Auto-paginates content across multiple slides. Hyperlinks are resolved automatically.
AddToSlide(SlidePart, string, ...) void Adds content to a single slide with positioned shapes and tables. Hyperlinks are resolved automatically.
ConvertToParagraphs(string) List<A.Paragraph> Converts to paragraphs for text body insertion. Tables are flattened to pipe-delimited rows.
ConvertToSlideElements(string) List<OpenXmlElement> Returns A.Paragraph and A.Table elements for slide-level insertion.
AppendToTextBody(A.TextBody, string) void Convenience method; appends paragraphs directly to a text body.

PresentationBuilder

Method Returns Description
CreatePresentation(string path, bool widescreen) PresentationDocument Creates a valid PPTX with theme, slide master, and layout.
CreatePresentation(Stream stream, bool widescreen) PresentationDocument Same as above but writes to a stream.
AddBlankSlide(PresentationDocument doc) SlidePart Adds a blank slide and returns its SlidePart.

Project Structure

md_to_pptx/
├── src/MdToPptx/                  # Core library
│   ├── MarkdownToPptxConverter.cs # Public API (single-slide & multi-slide)
│   ├── ConversionOptions.cs       # Styling configuration
│   ├── Converters/
│   │   ├── InlineConverter.cs     # Bold, italic, code, links
│   │   ├── BlockConverter.cs      # Paragraphs, headings, lists, quotes
│   │   └── TableConverter.cs      # Table conversion
│   └── Helpers/
│       ├── PptxElementFactory.cs  # OpenXML element builders
│       └── PresentationBuilder.cs # Valid PPTX skeleton creator
├── tests/MdToPptx.Tests/         # xUnit test suite (42 tests)
├── samples/SampleApp/            # Example console application
└── MdToPptx.sln

Running the Sample

cd samples/SampleApp
dotnet run

This creates a SampleOutput.pptx file you can open in PowerPoint.

Running Tests

dotnet test

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 154 3/27/2026 2.0.1 is deprecated.
1.0.1 137 2/14/2026 1.0.1 is deprecated.

Update documentation