Compare commits

...

5 Commits

7 changed files with 33 additions and 13 deletions

View File

@@ -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

View File

@@ -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());
}
}

View File

@@ -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();

View File

@@ -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
{

View File

@@ -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();
}

View File

@@ -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";
}
}

View File

@@ -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": {