Skip to content

fjwuyongzhi/MarkdownSharp-GithubCodeBlocks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

MarkdownSharp - With Github style code blocks

The original MarkdownSharp can be found on google code here https://code.google.com/p/markdownsharp/

This is basically a fork of that, that has been slightly modified to support github style code blocks.

If you're unfamiliar with MarkdownSharp, it's a markdown parser, which was ported from the original perl markdown parser. I believe it is what StackOverflow uses.

My light modifications allow this


```cs
public void Main()
{
  Console.WriteLine("Github Style Code blocks");
}
```

Which will be transformed to the following html

<pre><code class='language-cs'>
public void Main()
{
  Console.WriteLine("Github Style Code blocks");
}
</code></pre>

Then you can use a library like HighlightJS to sytnax highlight that code block, and since we added the class language-cs, it will be highlighted as c# code.

Whatever is after the 3 ticks will be put in the class name

so

```mylanguage

would transform to

<pre><code class='language-mylanguage'>

If anyone wants to add any of the other Github flavored stuff, feel free to pull request. Or, fix my mediocre implementation of the the Github Flavored Codeblocks

About

Markdown sharp edited to support github code blocks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%