Compare commits

...

12 Commits

Author SHA1 Message Date
Alexandre Mutel
b941a58ad0 Fix project.json 2016-06-10 17:16:37 +09:00
Alexandre Mutel
3fa20fa92f Update logo 2016-06-10 17:10:11 +09:00
Alexandre Mutel
5dcd4ea4aa Update logo for nuget. Bump version to 0.3.3 2016-06-10 17:03:49 +09:00
Alexandre Mutel
9c03683913 Add logo to readme 2016-06-10 17:01:17 +09:00
Alexandre Mutel
2fed1b3ebf Add markdig logo 2016-06-10 16:56:23 +09:00
Alexandre Mutel
9da3eef65f Bump to 0.3.2 2016-06-10 06:20:44 +09:00
Alexandre Mutel
0b4fe3f02f Modify tests to run default and advanced together on the core CommonMark specs to make sure the Advanced mode is compatible with the core specs (except for the AutoIdentifier that we are disabling) 2016-06-10 06:19:14 +09:00
Alexandre Mutel
96b39e1856 Fix exception when extension Media was active. Make sure that we only process absolute Uri for media 2016-06-10 06:18:19 +09:00
Alexandre Mutel
6d90f517cc Fix BlockProcessor.GoToColumn that was messing indent 2016-06-10 06:17:47 +09:00
Alexandre Mutel
c17630e3b6 Add link to babelmark3 2016-06-09 14:00:06 +09:00
Alexandre Mutel
6eecfe2edc Bump version to 0.3.1 2016-06-09 10:13:53 +09:00
Alexandre Mutel
9abeb97394 Remove Bootstrap and add ListExtra to the UseAdvancedExtensions 2016-06-09 10:13:39 +09:00
11 changed files with 162 additions and 15 deletions

BIN
images/markdig.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

124
images/markdig.svg Normal file
View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="192"
height="192"
viewBox="0 0 192 192"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="markdig.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.6203867"
inkscape:cx="274.42608"
inkscape:cy="145.36182"
inkscape:document-units="px"
inkscape:current-layer="g4154"
showgrid="false"
inkscape:window-width="2560"
inkscape:window-height="1377"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
units="px" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
style="display:inline"
transform="translate(0,-860.36216)">
<g
id="g4154"
transform="matrix(38.543914,0,0,38.552171,-1185.0408,-955.47573)">
<path
style="fill:#000000"
inkscape:connector-curvature="0"
d="m 31.644129,50.284653 c -0.02217,0.02214 -0.04404,0.04469 -0.05945,0.0741 l -0.735055,1.351325 c -0.04175,0.07002 -0.04056,0.138759 5.12e-4,0.181019 0.0272,0.02824 0.06784,0.0361 0.11251,0.02579 0.01796,-0.0042 0.04467,-0.01031 0.06465,-0.02343 L 32.366,51.153314 c 0.02869,-0.01511 0.05106,-0.03775 0.07307,-0.05991 l 1.33603,-1.352005 -0.797174,-0.799407 -1.333959,1.342865 z"
id="path4140" />
<path
inkscape:connector-curvature="0"
id="path4142"
d="m 33.629834,47.14509 c -0.05143,0 -0.102813,0.02035 -0.143929,0.06185 l -0.452371,0.453699 -0.339289,-0.340288 c -0.08223,-0.08249 -0.205627,-0.08249 -0.287859,0 -0.08223,0.08249 -0.08223,0.206242 0,0.288728 l 0.339289,0.340288 -0.287859,0.278382 2.128264,2.113818 0.28786,-0.288728 0.359871,0.350578 c 0.04097,0.04127 0.09255,0.06185 0.143929,0.06185 0.05143,0 0.102814,-0.02035 0.14393,-0.06185 0.08223,-0.08249 0.08223,-0.206243 0,-0.288728 l -0.359871,-0.340288 0.45237,-0.44341 c 0.03061,-0.04127 0.05143,-0.09283 0.05143,-0.154681 0,-0.05145 -0.02072,-0.103121 -0.0617,-0.144336 l -1.830134,-1.825022 c -0.04097,-0.04127 -0.09255,-0.06185 -0.143929,-0.06185 z m 0.411725,0.538446 0.246508,0.247174 -0.104933,0.599544 0.597939,-0.105213 0.246508,0.247174 -0.955889,0.958455 -0.246507,-0.247174 0.548227,-0.549696 -0.597934,0.105213 0.104933,-0.59955 -0.548232,0.549696 -0.246508,-0.247174 0.955888,-0.958454 z"
style="fill:#000000;fill-opacity:1" />
<rect
y="34.228416"
x="34.416744"
width="0"
height="0"
ry="0"
mask="url(#a)"
id="rect4168" />
<rect
y="33.914825"
x="33.238689"
width="0"
height="0"
ry="0"
mask="url(#a)"
id="rect4184" />
<rect
y="31.953135"
x="33.002754"
width="0.004530983"
height="0.0037847031"
ry="0.056770544"
mask="url(#a)"
id="rect4200" />
<flowRoot
transform="matrix(0.00453098,0,0,0.0037847,43.709468,34.287871)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="flowRoot4797"
xml:space="preserve"><flowRegion
id="flowRegion4799"><rect
y="-976.15039"
x="959.01355"
height="618.71844"
width="972.27185"
id="rect4801" /></flowRegion><flowPara
id="flowPara4803"></flowPara></flowRoot> <g
transform="matrix(0.00246733,0,0,0.00235052,43.616236,34.351245)"
id="g4833">
<rect
style="fill:#ffffff"
y="0"
x="0"
width="1"
height="1"
id="rect4823" />
</g>
<path
style="fill:#000000;fill-opacity:1"
d="m 33.629834,47.14509 c -0.05143,0 -0.102813,0.02035 -0.143929,0.06185 l -0.452371,0.453699 -0.339289,-0.340288 c -0.08223,-0.08249 -0.205627,-0.08249 -0.287859,0 -0.08223,0.08249 -0.08223,0.206242 0,0.288728 l 0.339289,0.340288 -0.287859,0.278382 2.128264,2.113818 0.28786,-0.288728 0.359871,0.350578 c 0.04097,0.04127 0.09255,0.06185 0.143929,0.06185 0.05143,0 0.102814,-0.02035 0.14393,-0.06185 0.08223,-0.08249 0.08223,-0.206243 0,-0.288728 l -0.359871,-0.340288 0.45237,-0.44341 c 0.03061,-0.04127 0.05143,-0.09283 0.05143,-0.154681 0,-0.05145 -0.02072,-0.103121 -0.0617,-0.144336 l -1.830134,-1.825022 c -0.04097,-0.04127 -0.09255,-0.06185 -0.143929,-0.06185 z m 0.411725,0.538446 0.246508,0.247174 -0.104933,0.599544 0.597939,-0.105213 0.246508,0.247174 -0.955889,0.958455 -0.246507,-0.247174 0.548227,-0.549696 -0.597934,0.105213 0.104933,-0.59955 -0.548232,0.549696 -0.246508,-0.247174 0.955888,-0.958454 z"
id="path4886"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
images/markdig64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,9 +1,13 @@
# Markdig [![Build status](https://ci.appveyor.com/api/projects/status/hk391x8jcskxt1u8?svg=true)](https://ci.appveyor.com/project/xoofx/markdig) [![NuGet](https://img.shields.io/nuget/v/Markdig.svg)](https://www.nuget.org/packages/Markdig/)
<img align="right" width="128px" height="128px" src="images/markdig.png">
Markdig is a fast, powerfull, [CommonMark](http://commonmark.org/) compliant, extensible Markdown processor for .NET.
> 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

@@ -32,7 +32,7 @@ namespace Markdig
public static class MarkdownExtensions
{
/// <summary>
/// Uses all extensions except the Emoji, SmartyPants and soft line as hard line breaks.
/// Uses all extensions except the BootStrap, Emoji, SmartyPants and soft line as hard line breaks extensions.
/// </summary>
/// <param name="pipeline">The pipeline.</param>
/// <returns>The modified pipeline</returns>
@@ -41,7 +41,6 @@ namespace Markdig
return pipeline
.UseAbbreviation()
.UseAutoIdentifier()
.UseBootstrap()
.UseCite()
.UseCustomContainer()
.UseDefinitionList()
@@ -53,6 +52,7 @@ namespace Markdig
.UseMath()
.UseMedia()
.UsePipeTable()
.UseListExtra()
.UseGenericAttributes(); // Must be last as it is one parser that is modifying other parsers
}

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.0";
public const string Version = "0.3.3";
}
}

View File

@@ -1,6 +1,6 @@
{
"title": "Markdig",
"version": "0.3.0",
"version": "0.3.3",
"authors": [ "Alexandre Mutel" ],
"description": "A fast, powerfull, CommonMark compliant, extensible Markdown processor for .NET",
"copyright": "Alexandre Mutel",
@@ -9,8 +9,9 @@
"owners": [ "Alexandre Mutel" ],
"licenseUrl": "https://github.com/lunet-io/markdig/blob/master/license.txt",
"projectUrl": "https://github.com/lunet-io/markdig",
"iconUrl": "https://raw.githubusercontent.com/lunet-io/markdig/master/images/markdig64.png",
"requireLicenseAcceptance": false,
"releaseNotes": "Fix potential IndexOutOfRange exception when a backstick were not matched. Add Configure method. Rename UseAllExtensions() by UseAdvancedExtensions()",
"releaseNotes": "Update logo for NuGet",
"tags": [ "Markdown CommonMark md html md2html" ]
},
"configurations": {