Skip to content

Commit 27fca30

Browse files
committed
Fix lists continuations.
List continuations that have blank lines are considered loose. As per commonmark spec these should render as paragraphs. `EnableTrackTrivia()` was breaking this behaviour. Validated we don't need triva for error message highlighting.
1 parent 100ec31 commit 27fca30

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

src/Elastic.Markdown/Myst/Comments/CommentBlockParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public override bool Close(BlockProcessor processor, Block block)
155155
{
156156
if (!processor.TrackTrivia)
157157
{
158-
var heading = (HeadingBlock)block;
158+
var heading = (CommentBlock)block;
159159
heading.Lines.Trim();
160160
}
161161

src/Elastic.Markdown/Myst/MarkdownParser.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public static MarkdownPipeline Pipeline
6060
return _pipeline;
6161

6262
var builder = new MarkdownPipelineBuilder()
63-
.EnableTrackTrivia()
6463
.UseInlineAnchors()
6564
.UsePreciseSourceLocation()
6665
.UseDiagnosticLinks()

tests/authoring/Blocks/Lists.fs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
module ``block elements``.``lists``
2+
3+
open Xunit
4+
open authoring
5+
6+
type ``supports loose lists`` () =
7+
static let markdown = Setup.Markdown """
8+
* **Consumption-based billing**:
9+
10+
You pay for the actual product used, regardless of the application or use case. This is different from subscription-based billing models where customers pay a flat fee restricted by usage quotas, or one-time upfront payment billing models such as those used for on-prem software licenses.
11+
12+
You can purchase credits for a single or multi-year contract. Consumption is on demand, and every month we deduct from your balance based on your usage and contract terms. This allows you to seamlessly expand your usage to the full extent of your requirements and available budget, without any quotas or restrictions.
13+
"""
14+
15+
[<Fact>]
16+
let ``validate HTML: adds paragraphs`` () =
17+
markdown |> convertsToHtml """
18+
<ul>
19+
<li>
20+
<p>
21+
<strong>Consumption-based billing</strong>:</p>
22+
<p>You pay for the actual product used, regardless of the application or use case. This is different from subscription-based billing models where customers pay a flat fee restricted by usage quotas, or one-time upfront payment billing models such as those used for on-prem software licenses.</p>
23+
<p>You can purchase credits for a single or multi-year contract. Consumption is on demand, and every month we deduct from your balance based on your usage and contract terms. This allows you to seamlessly expand your usage to the full extent of your requirements and available budget, without any quotas or restrictions.</p>
24+
</li>
25+
</ul>
26+
"""
27+

tests/authoring/authoring.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
<ItemGroup>
4848
<Compile Include="Blocks\CodeBlocks\CodeBlocks.fs" />
49+
<Compile Include="Blocks\Lists.fs" />
4950
</ItemGroup>
5051

5152
</Project>

0 commit comments

Comments
 (0)