Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lists continuations. #435

Merged
merged 7 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/syntax/applies.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ Are equivalent, note `all` just means we won't be rendering the version portion
## This section has its own applies annotations [#sections]

:::{applies}
:stack: unavailable
:serverless: tech-preview
:cloud: ga
:serverless: unavailable
:::

:::{note}
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.Markdown/Myst/Comments/CommentBlockParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public override bool Close(BlockProcessor processor, Block block)
{
if (!processor.TrackTrivia)
{
var heading = (HeadingBlock)block;
var heading = (CommentBlock)block;
heading.Lines.Trim();
}

Expand Down
1 change: 0 additions & 1 deletion src/Elastic.Markdown/Myst/MarkdownParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public static MarkdownPipeline Pipeline
return _pipeline;

var builder = new MarkdownPipelineBuilder()
.EnableTrackTrivia()
.UseInlineAnchors()
.UsePreciseSourceLocation()
.UseDiagnosticLinks()
Expand Down
16 changes: 8 additions & 8 deletions tests/Elastic.Markdown.Tests/Directives/AdmonitionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ public class NestedDirectiveWithListTests(ITestOutputHelper output) : DirectiveT
{
[Fact]
public void Render() => Html.Should().Contain("""
<li> List Item 1
<li>List Item 1
<div class="admonition note">
<p class="admonition-title">Note</p>
Hello, World!
Hello, World!
</div>
</li>
""");
Expand All @@ -149,10 +149,10 @@ public class NestedDirectiveWithListTests2(ITestOutputHelper output) : Directive
{
[Fact]
public void Render() => Html.Should().Contain("""
<li> List Item 1
<li>List Item 1
<div class="admonition note">
<p class="admonition-title">Note</p>
Hello, World!
Hello, World!
</div>
</li>
""");
Expand All @@ -177,10 +177,10 @@ public class NestedDirectiveWithListTests3(ITestOutputHelper output) : Directive
{
[Fact]
public void Render() => Html.Should().Contain("""
<li> List Item 1
<li>List Item 1
<div class="admonition note">
<p class="admonition-title">Note</p>
Hello, World!
Hello, World!
</div>
</li>
""");
Expand All @@ -203,10 +203,10 @@ public class DirectiveInList(ITestOutputHelper output) : DirectiveTest<Admonitio

[Fact]
public void Render() => Html.Should().Contain("""
<li> List Item 1
<li>List Item 1
<div class="admonition note">
<p class="admonition-title">Note</p>
Hello, World!
Hello, World!
</div>
</li>
""");
Expand Down
2 changes: 1 addition & 1 deletion tests/Elastic.Markdown.Tests/Inline/InlineAnchorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void GeneratesAttributesInHtml() =>
// language=html
Html.Should().Be(
"""
<section id="my-anchor"><h2>Hello world <a class="headerlink" href="#my-anchor" title="Link to this heading">¶</a>
<section id="my-anchor"><h2>Hello world<a class="headerlink" href="#my-anchor" title="Link to this heading">¶</a>
</h2>
</section>
""".TrimEnd()
Expand Down
4 changes: 2 additions & 2 deletions tests/Elastic.Markdown.Tests/Inline/InlineLinkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ public void GeneratesHtml() =>
Html.TrimEnd().Should().Be("""
<p>Links:</p>
<ul>
<li> <a href="/testing/req.html">Special Requirements</a></li>
<li><a href="/testing/req.html">Special Requirements</a></li>
</ul>
<ul>
<li> <a href="/testing/req.html">Special Requirements</a></li>
<li><a href="/testing/req.html">Special Requirements</a></li>
</ul>
""");

Expand Down
30 changes: 30 additions & 0 deletions tests/authoring/Blocks/Lists.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information
module ``block elements``.``list elements``

open Xunit
open authoring

type ``supports loose lists`` () =
static let markdown = Setup.Markdown """
* **Consumption-based billing**:

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.

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.
"""

[<Fact>]
let ``validate HTML: adds paragraphs`` () =
markdown |> convertsToHtml """
<ul>
<li>
<p>
<strong>Consumption-based billing</strong>:</p>
<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>
<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>
</li>
</ul>
"""

31 changes: 31 additions & 0 deletions tests/authoring/Container/DefinitionLists.fs
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,34 @@ This is my `definition`
"""
[<Fact>]
let ``has no errors 2`` () = markdown |> hasNoErrors



type ``preserves paragraphs`` () =

static let markdown = Setup.Markdown """
Elastic Consumption Unit (ECU)
: An ECU is a unit of aggregate consumption across multiple resources over time.

Each type of computing resource (capacity, data transfer, and snapshot) that you consume has its own unit of measure.

In order to aggregate consumption across different resource types, all resources are priced in ECU.

Check Using Elastic Consumption Units for billing for more details.
"""

[<Fact>]
let ``validate HTML 2`` () =
markdown |> convertsToHtml """
<dl>
<dt>Elastic Consumption Unit (ECU)</dt>
<dd>
<p>An ECU is a unit of aggregate consumption across multiple resources over time.</p>
<p>Each type of computing resource (capacity, data transfer, and snapshot) that you consume has its own unit of measure.</p>
<p>In order to aggregate consumption across different resource types, all resources are priced in ECU.</p>
<p>Check Using Elastic Consumption Units for billing for more details.</p>
</dd>
</dl>
"""
[<Fact>]
let ``has no errors`` () = markdown |> hasNoErrors
1 change: 1 addition & 0 deletions tests/authoring/authoring.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

<ItemGroup>
<Compile Include="Blocks\CodeBlocks\CodeBlocks.fs" />
<Compile Include="Blocks\Lists.fs" />
</ItemGroup>

</Project>