mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-08 13:54:54 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9da3eef65f | ||
|
|
0b4fe3f02f | ||
|
|
96b39e1856 | ||
|
|
6d90f517cc | ||
|
|
c17630e3b6 |
@@ -4,6 +4,8 @@ Markdig is a fast, powerfull, [CommonMark](http://commonmark.org/) compliant, ex
|
||||
|
||||
> NOTE: The repository is under construction. There will be a dedicated website and proper documentation at some point!
|
||||
|
||||
You can **try Markdig online** and compare it to other implems on [babelmark3](http://babelmark.github.io/)
|
||||
|
||||
## Features
|
||||
|
||||
- **Very fast parser** (no-regexp), very lightweight in terms of GC pressure. See benchmarks
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace Markdig.Tests
|
||||
{
|
||||
foreach (var pipeline in GetPipeline(extensions))
|
||||
{
|
||||
Console.WriteLine($"Pipeline configured with extensions: {extensions}");
|
||||
Console.WriteLine($"Pipeline configured with extensions: {pipeline.Key}");
|
||||
// Uncomment this line to get more debug information for process inlines.
|
||||
//pipeline.DebugLog = Console.Out;
|
||||
var result = Markdown.ToHtml(inputText, pipeline);
|
||||
var result = Markdown.ToHtml(inputText, pipeline.Value);
|
||||
|
||||
result = Compact(result);
|
||||
expectedOutputText = Compact(expectedOutputText);
|
||||
@@ -34,11 +34,30 @@ namespace Markdig.Tests
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<MarkdownPipeline> GetPipeline(string extensionsGroupText)
|
||||
private static IEnumerable<KeyValuePair<string, MarkdownPipeline>> GetPipeline(string extensionsGroupText)
|
||||
{
|
||||
// For the standard case, we make sure that both the CommmonMark core and Extra/Advanced are CommonMark compliant!
|
||||
if (string.IsNullOrEmpty(extensionsGroupText))
|
||||
{
|
||||
yield return new MarkdownPipelineBuilder().Build();
|
||||
yield return new KeyValuePair<string, MarkdownPipeline>("default", new MarkdownPipelineBuilder().Build());
|
||||
|
||||
yield return new KeyValuePair<string, MarkdownPipeline>("advanced", new MarkdownPipelineBuilder() // Use similar to advanced extension without auto-identifier
|
||||
.UseAbbreviation()
|
||||
//.UseAutoIdentifier()
|
||||
.UseCite()
|
||||
.UseCustomContainer()
|
||||
.UseDefinitionList()
|
||||
.UseEmphasisExtra()
|
||||
.UseFigure()
|
||||
.UseFooter()
|
||||
.UseFootnotes()
|
||||
.UseGridTable()
|
||||
.UseMath()
|
||||
.UseMedia()
|
||||
.UsePipeTable()
|
||||
.UseListExtra()
|
||||
.UseGenericAttributes().Build());
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
@@ -46,7 +65,7 @@ namespace Markdig.Tests
|
||||
foreach (var extensionsText in extensionGroups)
|
||||
{
|
||||
var pipeline = new MarkdownPipelineBuilder().Configure(extensionsText);
|
||||
yield return pipeline.Build();
|
||||
yield return new KeyValuePair<string, MarkdownPipeline>(extensionsText, pipeline.Build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace Markdig.Extensions.Medias
|
||||
if (linkInline.IsImage && linkInline.Url != null)
|
||||
{
|
||||
Uri uri;
|
||||
if (Uri.TryCreate(linkInline.Url, UriKind.RelativeOrAbsolute, out uri))
|
||||
// Only process absolute Uri
|
||||
if (Uri.TryCreate(linkInline.Url, UriKind.RelativeOrAbsolute, out uri) && uri.IsAbsoluteUri)
|
||||
{
|
||||
var htmlAttributes = new HtmlAttributes();
|
||||
var fromAttributes = linkInline.TryGetAttributes();
|
||||
|
||||
@@ -260,12 +260,10 @@ namespace Markdig.Parsers
|
||||
public void GoToColumn(int newColumn)
|
||||
{
|
||||
// Optimized path when we are moving above the previous start of indent
|
||||
if (newColumn > ColumnBeforeIndent)
|
||||
if (newColumn >= ColumnBeforeIndent)
|
||||
{
|
||||
Line.Start = StartBeforeIndent;
|
||||
Column = ColumnBeforeIndent;
|
||||
ColumnBeforeIndent = 0;
|
||||
StartBeforeIndent = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Markdig.Parsers
|
||||
}
|
||||
|
||||
// If we don't have a blank line, we reset to the indent
|
||||
if (processor.Indent >= 4)
|
||||
if (processor.Indent > 4)
|
||||
{
|
||||
processor.GoToCodeIndent();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ namespace Markdig
|
||||
{
|
||||
public static partial class Markdown
|
||||
{
|
||||
public const string Version = "0.3.1";
|
||||
public const string Version = "0.3.2";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"title": "Markdig",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"authors": [ "Alexandre Mutel" ],
|
||||
"description": "A fast, powerfull, CommonMark compliant, extensible Markdown processor for .NET",
|
||||
"copyright": "Alexandre Mutel",
|
||||
@@ -10,7 +10,7 @@
|
||||
"licenseUrl": "https://github.com/lunet-io/markdig/blob/master/license.txt",
|
||||
"projectUrl": "https://github.com/lunet-io/markdig",
|
||||
"requireLicenseAcceptance": false,
|
||||
"releaseNotes": "Add ListExtra as part of the UseAdvancedExtensions()",
|
||||
"releaseNotes": "Fix exception when Media extension was used with non absolute URI. Make the UseAdvancedExtensions() CommonMark compliant on core specs",
|
||||
"tags": [ "Markdown CommonMark md html md2html" ]
|
||||
},
|
||||
"configurations": {
|
||||
|
||||
Reference in New Issue
Block a user