Fix bug when a thematic break is inside a fenced code block inside a pending list (#164)

This commit is contained in:
Alexandre Mutel
2017-11-09 09:08:38 +01:00
parent aaff022e7c
commit 523582e588
2 changed files with 21 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
// Copyright (c) Alexandre Mutel. All rights reserved.
// This file is licensed under the BSD-Clause 2 license.
// This file is licensed under the BSD-Clause 2 license.
// See the license.txt file in the project root for more information.
using System;
using System.Collections.Generic;
@@ -19,6 +19,25 @@ namespace Markdig.Tests
TestSpec(markdownText, "<p><em>Unlimited-Fun®</em>®</p>");
}
[Test]
public void TestThematicInsideCodeBlockInsideList()
{
var input = @"1. In the :
```
Id DisplayName Description
-- ----------- -----------
62375ab9-6b52-47ed-826b-58e47e0e304b Group.Unified ...
```";
TestSpec(input, @"<ol>
<li><p>In the :</p>
<pre><code>Id DisplayName Description
-- ----------- -----------
62375ab9-6b52-47ed-826b-58e47e0e304b Group.Unified ...
</code></pre></li>
</ol>");
}
public static void TestSpec(string inputText, string expectedOutputText, string extensions = null)
{
foreach (var pipeline in GetPipeline(extensions))

View File

@@ -86,7 +86,7 @@ namespace Markdig.Parsers
// interpretations of a line, the thematic break takes precedence
BlockState result;
var thematicParser = ThematicBreakParser.Default;
if (thematicParser.HasOpeningCharacter(processor.CurrentChar))
if (!(processor.LastBlock is FencedCodeBlock) && thematicParser.HasOpeningCharacter(processor.CurrentChar))
{
result = thematicParser.TryOpen(processor);
if (result.IsBreak())