YamlFrontMatterExtension not working, probably my error #199

Closed
opened 2026-01-29 14:30:09 +00:00 by claunia · 1 comment
Owner

Originally created by @dullroar on GitHub (Mar 11, 2018).

First off, this is a great package - really well done, appreciate the hard work!

The extension is not working for me - it renders the YAML front matter in a <p> tag as the first content in the HTML output. I have tried:

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

...and:

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

....and:

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

I have also ensured that:

  1. The first line in the file is comprised of just ---, and those are the only three characters on the line (excluding the newline). hexdump shows the line as 2d 2d 2d 0a.
  2. The ... line following the front matter has only those three characters on the line (excluding the newline). hexdump shows the line as 2e 2e 2e 0a.
  3. The YAML is followed by a blank line.
  4. The YAML itself is extremely simple, as in:
---
title: Home
subtitle: A heaping plate of rambled eggs.
...

What am I doing wrong?

This is being used in a .NET Core application on Linux with Markdig NuGet package 0.14.8.

Originally created by @dullroar on GitHub (Mar 11, 2018). First off, this is a **great** package - really well done, appreciate the hard work! The extension is not working for me - it renders the YAML front matter in a `<p>` tag as the first content in the HTML output. I have tried: `var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();` ...and: `var pipeline = new MarkdownPipelineBuilder().UseYamlFrontMatter().UseAdvancedExtensions().Build();` ....and: `var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseYamlFrontMatter().Build();` I have also ensured that: 1. The first line in the file is comprised of just `---`, and those are the only three characters on the line (excluding the newline). `hexdump` shows the line as `2d 2d 2d 0a`. 2. The `...` line following the front matter has only those three characters on the line (excluding the newline). `hexdump` shows the line as `2e 2e 2e 0a`. 3. The YAML is followed by a blank line. 4. The YAML itself is extremely simple, as in: ```yaml --- title: Home subtitle: A heaping plate of rambled eggs. ... ``` What am I doing wrong? This is being used in a .NET Core application on Linux with Markdig NuGet package 0.14.8.
Author
Owner

@dullroar commented on GitHub (Mar 11, 2018):

Figured it out, I think. It is because after building up that pipeline, I don't actually pass it to the ToHtml method. Doh!

@dullroar commented on GitHub (Mar 11, 2018): Figured it out, I think. It is because after building up that pipeline, I don't actually pass it to the `ToHtml` method. Doh!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#199