Skip to content

Commit 3c0da5f

Browse files
authored
Add support for vertical definition lists (#348)
* Add support for vertical definition lists * Add tests for vertical definition lists
1 parent 764e19a commit 3c0da5f

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

src/Elastic.Markdown/Myst/MarkdownParser.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class MarkdownParser(
5151
.UseGridTables()
5252
.UsePipeTables()
5353
.UseDirectives()
54+
.UseDefinitionLists()
5455
.UseEnhancedCodeBlocks()
5556
.DisableHtml()
5657
.UseHardBreaks()
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Licensed to Elasticsearch B.V under one or more agreements.
2+
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3+
// See the LICENSE file in the project root for more information
4+
5+
module ``container elements``.``vertical definition lists``
6+
7+
open Xunit
8+
open authoring
9+
10+
type ``simple multiline definition with markup`` () =
11+
12+
static let markdown = Setup.Markdown """
13+
This is my `definition`
14+
: And this is the definition **body**
15+
Which may contain multiple lines
16+
"""
17+
18+
[<Fact>]
19+
let ``validate HTML`` () =
20+
markdown |> convertsToHtml """
21+
<dl>
22+
<dt>This is my <code>definition</code> </dt>
23+
<dd>
24+
<p> And this is the definition <strong>body</strong> <br>
25+
Which may contain multiple lines</p>
26+
</dd>
27+
</dl>
28+
"""
29+
[<Fact>]
30+
let ``has no errors`` () = markdown |> hasNoErrors
31+
32+
type ``with embedded directives`` () =
33+
34+
static let markdown = Setup.Markdown """
35+
This is my `definition`
36+
: And this is the definition **body**
37+
Which may contain multiple lines
38+
:::{note}
39+
My note
40+
:::
41+
"""
42+
43+
[<Fact>]
44+
let ``validate HTML`` () =
45+
markdown |> convertsToHtml """
46+
<dl>
47+
<dt>This is my <code>definition</code> </dt>
48+
<dd>
49+
<p> And this is the definition <strong>body</strong> <br>
50+
Which may contain multiple lines</p>
51+
<div class="admonition note">
52+
<p class="admonition-title">Note</p>
53+
<p>My note</p>
54+
</div>
55+
</dd>
56+
</dl>
57+
"""
58+
[<Fact>]
59+
let ``has no errors`` () = markdown |> hasNoErrors

tests/authoring/authoring.fsproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@
3737
<Compile Include="Inline\InlineAnchors.fs" />
3838
</ItemGroup>
3939

40+
<ItemGroup>
41+
<Compile Include="Container\DefinitionLists.fs" />
42+
</ItemGroup>
43+
4044
</Project>

0 commit comments

Comments
 (0)