Created
September 28, 2016 05:30
-
-
Save hhyyg/56325059768cc4a0997bfa049d410508 to your computer and use it in GitHub Desktop.
Markdig Sample https://github.com/lunet-io/markdig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2 id="table">Table</h2> | |
<table> | |
<thead> | |
<tr> | |
<th style="text-align: right;">Right</th> | |
<th style="text-align: left;">Left</th> | |
<th>Default</th> | |
<th style="text-align: center;">Center</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td style="text-align: right;">12</td> | |
<td style="text-align: left;">12</td> | |
<td>12</td> | |
<td style="text-align: center;">12</td> | |
</tr> | |
<tr> | |
<td style="text-align: right;">123</td> | |
<td style="text-align: left;">123</td> | |
<td>123</td> | |
<td style="text-align: center;">123</td> | |
</tr> | |
<tr> | |
<td style="text-align: right;">1</td> | |
<td style="text-align: left;">1</td> | |
<td>1</td> | |
<td style="text-align: center;">1</td> | |
</tr> | |
</tbody> | |
</table> | |
<table> | |
<col style="width:30%"> | |
<col style="width:30%"> | |
<col style="width:40%"> | |
<thead> | |
<tr> | |
<th>Fruit</th> | |
<th>Price</th> | |
<th>Advantages</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td>Bananas</td> | |
<td>$1.34</td> | |
<td> | |
<ul> | |
<li>built-in wrapper</li> | |
<li>bright color</li> | |
</ul> | |
</td> | |
</tr> | |
<tr> | |
<td>Oranges</td> | |
<td>$2.10</td> | |
<td> | |
<ul> | |
<li>cures scurvy</li> | |
<li>tasty</li> | |
</ul> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<h2 id="header-identifiers-in-html">Header Identifiers in HTML</h2> | |
<p><a href="#header-identifiers-in-html-given">Header identifiers in HTML</a></p> | |
<ul class="contains-task-list"> | |
<li class="task-list-item"><input disabled="disabled" type="checkbox" /> a task list item</li> | |
<li class="task-list-item"><input disabled="disabled" type="checkbox" /> list syntax required</li> | |
<li class="task-list-item"><input disabled="disabled" type="checkbox" /> normal <strong>formatting</strong>, @mentions, #1234 refs</li> | |
<li class="task-list-item"><input disabled="disabled" type="checkbox" /> incomplete</li> | |
<li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> completed</li> | |
</ul> | |
<p><customTag></customTag></p> | |
<div><aa:customTag></aa:customTag></div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Markdig; | |
namespace ConsoleApplication2 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string input = @" | |
## Table | |
| Right | Left | Default | Center | | |
|------:|:-----|---------|:------:| | |
| 12 | 12 | 12 | 12 | | |
| 123 | 123 | 123 | 123 | | |
| 1 | 1 | 1 | 1 | | |
+---------------+---------------+--------------------+ | |
| Fruit | Price | Advantages | | |
+===============+===============+====================+ | |
| Bananas | $1.34 | - built-in wrapper | | |
| | | - bright color | | |
+---------------+---------------+--------------------+ | |
| Oranges | $2.10 | - cures scurvy | | |
| | | - tasty | | |
+---------------+---------------+--------------------+ | |
## Header Identifiers in HTML | |
[Header identifiers in HTML](#header-identifiers-in-html-given) | |
- [ ] a task list item | |
- [ ] list syntax required | |
- [ ] normal **formatting**, @mentions, #1234 refs | |
- [ ] incomplete | |
- [x] completed | |
<customTag></customTag> | |
<div><aa:customTag></aa:customTag></div> | |
"; | |
var pipeline = new Markdig.MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); | |
var result = Markdig.Markdown.ToHtml(input, pipeline); | |
Console.WriteLine(result); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment