Skip to content

Commit

Permalink
Upgrade markdig to 2.60.0 (dotnet#7712)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih authored Nov 16, 2021
1 parent e641228 commit 8388ba4
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Shared/base.netstandard.props" />
<ItemGroup>
<PackageReference Include="Markdig" Version="0.20.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.DocAsCode.Build.Common\Microsoft.DocAsCode.Build.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.4.9" />
<PackageReference Include="Markdig" Version="0.20.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="2.0.10" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ public Block CurrentBlock

public void AggregateTo(Block block, int blockCount)
{
_blocks[_currentBlockIndex] = block;
if (block != _blocks[_currentBlockIndex])
{
_blocks[_currentBlockIndex] = block;
}
RemoveRange(_currentBlockIndex + 1, blockCount - 1);
_currentBlockIndex = -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ private static TabItemBlock CreateTabItem(
}
offset -= blocks.Count;

pair.Item3.Remove();

var title = new TabTitleBlock
{
Inline = pair.Item3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="../Shared/base.netstandard.props" />

<ItemGroup>
<PackageReference Include="Markdig" Version="0.20.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ private void RewriteContainerBlock(ContainerBlock blocks)
}

var rewrittenToken = _rewriter.Rewrite(block);
if (rewrittenToken != null && rewrittenToken is Block rewrittenBlock)
if (rewrittenToken != null && rewrittenToken != blocks[i] && rewrittenToken is Block rewrittenBlock)
{
blocks[i] = rewrittenBlock;
block = rewrittenBlock;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ namespace Microsoft.DocAsCode.MarkdigEngine.Extensions

public class TabContentBlock : ContainerBlock
{
public TabContentBlock(List<Block> blocks) : base(null)
public TabContentBlock(List<Block> blocks)
: base(null)
{
foreach(var item in blocks)
foreach (var item in blocks)
{
Add(item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class XrefInlineExtension : IMarkdownExtension
{
public void Setup(MarkdownPipelineBuilder pipeline)
{
pipeline.InlineParsers.InsertBefore<AutolineInlineParser>(new XrefInlineParser());
pipeline.InlineParsers.InsertBefore<AutolinkInlineParser>(new XrefInlineParser());
pipeline.InlineParsers.AddIfNotAlready(new XrefInlineShortParser());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private bool MatchXrefShortcutWithQuote(InlineProcessor processor, ref StringSli

var c = slice.NextChar();

while (c != startChar && !c.IsNewLine() && !c.IsZero())
while (c != startChar && !c.IsNewLineOrLineFeed() && !c.IsZero())
{
href.Append(c);
c = slice.NextChar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="../Shared/base.netstandard.props" />

<ItemGroup>
<PackageReference Include="Markdig" Version="0.20.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="../Shared/base.netstandard.props" />

<ItemGroup>
<PackageReference Include="Markdig" Version="0.20.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
<PackageReference Include="Microsoft.Composition" Version="1.0.31" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void BaseTest()
Assert.Equal(2, model.Count);
Assert.Equal("System.String", model[0].Uid);
Assert.NotNull(model[0].UidSource);
Assert.Equal("author: rpetrusha\nms.author: ronpet\nmanager: wpickett", model[0].YamlCodeBlock);
Assert.Equal("author: rpetrusha\nms.author: ronpet\nmanager: wpickett", model[0].YamlCodeBlock.Replace("\r", ""));
Assert.NotNull(model[0].YamlCodeBlockSource);
Assert.Equal(4, model[0].Contents.Count);
Assert.Equal("summary", model[0].Contents[0].PropertyName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Shared\test.base.props" />
<ItemGroup>
<PackageReference Include="Markdig" Version="0.20.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.DocAsCode.Build.OverwriteDocuments\Microsoft.DocAsCode.Build.OverwriteDocuments.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void TestDfmYamlHeader_General()
translationtype: Human Translation
ms.sourcegitcommit: 5c6fbfc8699d7d66c40b0458972d8b6ef0dcc705
ms.openlocfilehash: 2ea129ac94cb1ddc7486ba69280dc0390896e088</yamlheader>";
Assert.Equal(expected.Replace("\r\n", "\n"), marked.Html);
Assert.Equal(expected.Replace("\r\n", "\n"), marked.Html.Replace("\r\n", "\n"));
}
}
}
2 changes: 1 addition & 1 deletion tools/YamlSplitter/YamlSplitter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.1" />
<PackageReference Include="Markdig" Version="0.20.0" />
<PackageReference Include="Markdig" Version="0.26.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="3.0.5" />
<PackageReference Include="YamlDotNet.Signed" Version="5.1.0" />
Expand Down

0 comments on commit 8388ba4

Please sign in to comment.