Help using Markdig with GitHub Flavored Markdown #281

Closed
opened 2026-01-29 14:32:42 +00:00 by claunia · 2 comments
Owner

Originally created by @mattvarghese on GitHub (Feb 27, 2019).

Hi Folks -

Question

I'm trying to find a Markdown parser that can handle GitHub Flavored Markdown (GFM) in C#. Can Markdig do this? If yes, can you help me with what I am missing?

Currently, my code looks like this:

private string convertMarkDig(string markdown)
{
	MarkdownPipeline pl = new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub).Build();
	return Markdown.ToHtml(markdown, pl);
}

This still does not handle GFM correctly. For example,

  • using the "-" character to make an unordered list in GFM.

If you can help me figure out how to use Markdig for GFM, that will be much appreciated!

Broader Context

I'm working on implementing the CDS Hooks standard, and one of requirements is that the details for display within a card is coded as Github Flavored Markdown. I need to convert this to HTML.

Originally created by @mattvarghese on GitHub (Feb 27, 2019). Hi Folks - ### Question I'm trying to find a Markdown parser that can handle [GitHub Flavored Markdown (GFM)](https://github.github.com/gfm/) in C#. Can Markdig do this? If yes, can you help me with what I am missing? Currently, my code looks like this: <pre> private string convertMarkDig(string markdown) { MarkdownPipeline pl = new MarkdownPipelineBuilder().UseAutoIdentifiers(AutoIdentifierOptions.GitHub).Build(); return Markdown.ToHtml(markdown, pl); } </pre> This still does not handle GFM correctly. For example, - using the "-" character to make an unordered list in GFM. If you can help me figure out how to use Markdig for GFM, that will be much appreciated! ### Broader Context I'm working on implementing the [CDS Hooks](https://github.com/cds-hooks/docs) standard, and one of requirements is that the [details for display within a card](https://cds-hooks.org/specification/1.0/#card-attributes) is coded as Github Flavored Markdown. I need to convert this to HTML.
Author
Owner

@MihaZupan commented on GitHub (Feb 27, 2019):

This still does not handle GFM correctly. For example,

  • using the "-" character to make an unordered list in GFM.

It does. Perhaps you did not use a space after '-'?

@MihaZupan commented on GitHub (Feb 27, 2019): > This still does not handle GFM correctly. For example, > >* using the "-" character to make an unordered list in GFM. It does. Perhaps you did not use a space after '-'?
Author
Owner

@mattvarghese commented on GitHub (Feb 27, 2019):

@MihaZupan, you are correct. That was the issue. Even though the source page had space between "-" and the first char, somehow, when copying into visual studio, that had gotten lost for me.
Copied again, and it works correctly. Thanks 👍

@mattvarghese commented on GitHub (Feb 27, 2019): @MihaZupan, you are correct. That was the issue. Even though the source page had space between "-" and the first char, somehow, when copying into visual studio, that had gotten lost for me. Copied again, and it works correctly. Thanks 👍
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#281