Skip to content

SuavePirate/Markdig.BadHeadersMarkdownExtension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Markdig.BadHeadersMarkdownExtension

A Markdig Extension for handling bad headers without a space after the "#"

What does that mean? Your markdown can have inproper headers and proper headers together and be properly parsed. It means this

"# Title\nsome body text and *such*\n## Subtitle with other words\n";

and this

"#Title\nsome body text and *such*\n##Subtitle with other words\n";

both become this

"<h1>Title</h1>\n<p>some body text and <em>such</em></p>\n<h2>Subtitle with other words</h2>\n"

Installation

Use NuGet! https://www.nuget.org/packages/MarkdigBadHeaders

Install-Package MarkdigBadHeaders

Usage

Add it to your pipeline that you use to parse:

var pipelineBuilder = new MarkdownPipelineBuilder();
pipelineBuilder = MarkdownExtensions.Use<BadHeadersExtension>(pipelineBuilder);
var pipeline = pipelineBuilder.Build();
var html = Markdown.ToHtml(BAD_HEADER_MARKDOWN, _pipeline);

Markdig Shoutout

Markdig is the latest and greatest of .NET Markdown processors. Without them, this wouldn't be possible. https://github.com/lunet-io/markdig

About

A Markdig Extension for handling bad headers without a space after the "#"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages