Skip to content

Nodsoft/Nodsoft.Markdig.SyntaxHighlighting

 
 

Repository files navigation

GitHub issues GitHub forks GitHub stars GitHub license NuGet NuGet

Nodsoft.Markdig.SyntaxHighlighting

Syntax Highlighting extension for Markdig

An extension that adds Syntax Highlighting, also known as code colourization, to a Markdig pipeline through the power of ColorCode. By simply adding this extension to your pipeline, you can add colour and style to your source code in markdown files.

PSA

This project is a fork of Richard Slater's Markdig.SyntaxHighlighting. It has been ported to .NET 6.0 by our team, and will continue to be supported for the foreseeable future as we use this lib for our downstream projects.

Demonstration

Before

namespace Amido.VersionDashboard.Web.Domain 
{
    public interface IConfigProvider 
    {
        string GetSetting(string appSetting);
    }
}

After

namespace Amido.VersionDashboard.Web.Domain 
{
    public interface IConfigProvider 
    {
        string GetSetting(string appSetting);
    }
}

Usage

Simply import the nuget package, add a using statement for Markdig.SyntaxHighlighting and add to your pipeline:

var pipeline = new MarkdownPipelineBuilder()
    .UseAdvancedExtensions()
    .UseSyntaxHighlighting()
    .Build();