Skip to content

Commit a3232b4

Browse files
committed
Force colon fences for all directives
1 parent 4b3ff3a commit a3232b4

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

mdformat_myst/_directives.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def fence(node: "RenderTreeNode", context: "RenderContext") -> str:
5050
is_directive = lang.startswith("{") and lang.endswith("}")
5151
unformatted_body = node.content
5252

53-
if node.type == "colon_fence":
53+
if node.type == "colon_fence" or is_directive:
5454
fence_char = ":"
5555
# Info strings of backtick code fences can not contain backticks or tildes.
5656
# If that is the case, we make a tilde code fence instead.

tests/data/fixtures.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -434,37 +434,37 @@ Content
434434
Content
435435
```
436436
.
437-
```{some-directive} args
437+
:::{some-directive} args
438438
---
439439
option1: 1
440440
option2: hello
441441
---
442442
Content
443-
```
443+
:::
444444
445-
```{some-directive} args
445+
:::{some-directive} args
446446
---
447447
option1: 1
448448
option2: hello
449449
---
450450
Content
451-
```
451+
:::
452452
453-
```{some-directive} args
453+
:::{some-directive} args
454454
---
455455
option1: 1
456456
option2: hello
457457
---
458458
Content
459-
```
459+
:::
460460
461-
```{some-directive} args
461+
:::{some-directive} args
462462
---
463463
option1: 1
464464
option2: hello
465465
---
466466
Content
467-
```
467+
:::
468468
.
469469
470470
@@ -475,11 +475,11 @@ MyST directive empty YAML
475475
Content
476476
```
477477
.
478-
```{some-directive} args
478+
:::{some-directive} args
479479
---
480480
---
481481
Content
482-
```
482+
:::
483483
.
484484
485485
MyST directive no content
@@ -489,20 +489,20 @@ MyST directive no content
489489
490490
```
491491
.
492-
```{some-directive} args
492+
:::{some-directive} args
493493
---
494494
letter: a
495495
---
496-
```
496+
:::
497497
.
498498
499499
MyST directive, no opts or content
500500
.
501501
``` {some-directive} args
502502
```
503503
.
504-
```{some-directive} args
505-
```
504+
:::{some-directive} args
505+
:::
506506
.
507507
MyST colon fenced directive with title
508508
.

0 commit comments

Comments
 (0)