QuestMark 0.0.4

dotnet add package QuestMark --version 0.0.4
                    
NuGet\Install-Package QuestMark -Version 0.0.4
                    
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="QuestMark" Version="0.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="QuestMark" Version="0.0.4" />
                    
Directory.Packages.props
<PackageReference Include="QuestMark" />
                    
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 QuestMark --version 0.0.4
                    
#r "nuget: QuestMark, 0.0.4"
                    
#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 QuestMark@0.0.4
                    
#: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=QuestMark&version=0.0.4
                    
Install as a Cake Addin
#tool nuget:?package=QuestMark&version=0.0.4
                    
Install as a Cake Tool

QuestMark

This library allows you to render markdown to PDF. It uses the Markdig library to parse the markdown and the QuestPDF library to render the PDF component, hence the name. If you use these libraries, QuestMark might be of use to you.

The code in this library is heavily inspired by the HTML renderer found in the Markdig source code.

Note: This is extremely experimental!

Getting Started

This library uses the lovely Markdig and QuestPDF libraries to render simple markdown into a QuestPDF component. Most of the time you will be hand-crafting your PDFs using QuestPDF with fairly predictable and nearly static content, but sometimes you might have the need to render some arbitrary markdown into a component inside your document without it appearing ugly and unformatted. That's where QuestMark comes in.

Note: Only fairly basic markdown features are supported at the moment

Installation

QuestMark is available as a NuGet package. Otherwise, simply copy the parts you need - I'm not fussed.

Command line
dotnet add package QuestMark

Usage

Here's an example taken from this repository:

// Program.cs

using Markdig;
using QuestMark.Components;
using QuestPDF.Companion;
using QuestPDF.Fluent;
using QuestPDF.Helpers;
using QuestPDF.Infrastructure;

// Select the approprate QuestPDF license for your usage:
QuestPDF.Settings.License = LicenseType.Community;

// Build the Markdig pipeline:
MarkdownPipeline pipeline = new MarkdownPipelineBuilder()
    .UseAutoLinks()
    .UseNonAsciiNoEscape()
    .UseListExtras()
    .UseAbbreviations()
    .UseEmphasisExtras()
    .UseSoftlineBreakAsHardlineBreak()
    .DisableHtml()
    .Build();

string markdown = File.ReadAllText("./your-file.md");

// Construct the MarkdownComponent (similar API to Markdig):
MarkdownComponent component = QuestMark.Markdown.ToMarkdownComponent(pipeline, markdown);

// Create QuestPDF document:
Document document = Document.Create(document =>
{
    document.Page(page =>
    {
        page.Size(PageSizes.A4);
        page.PageColor(Colors.White);
        page.Margin(10);

        // Add component to page:
        IContainer content = page.Content();
        content.Component(component);
    });
});

bool imUsingTheQuestPDFCompanionApp = true;

if (imUsingTheQuestPDFCompanionApp)
{
    document.ShowInCompanion();
}
else
{
    document.GeneratePdfAndShow();
}

Customizing Renderer

There is basic support for customizing each renderer. You will need to create a PdfStyleOptions object and set any of the delegate functions found there with your own.

For example:

// Override default styling options for headings and lists:
PdfStyleOptions styleOptions = new()
{
    HeadingTextStyler = (level) =>
    {
        Int32 size = 40 - level * 4;
        TextStyle style = TextStyle.Default.FontSize(size).FontColor(Colors.Grey.Lighten1);

        if (level < 2 && level >= 4)
        {
            style.SemiBold();
        }
        else if (level < 4)
        {
            style.Bold();
        }

        return style;
    },
    ListStyler = (container, depth) => container.PaddingLeft(depth * 4),
};

// Construct the MarkdownComponent (similar API to Markdig):
MarkdownComponent component = QuestMark.Markdown.ToMarkdownComponent(
    pipeline,
    markdown,
    styleOptions // pass it in here
);

To Do

  • render images instead of rendering a link to the image
  • support as many Markdig extensions as possible
    • tables
    • alerts
    • footnotes
    • JIRA links
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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
0.0.4 106 5/14/2026
0.0.3 113 3/9/2026