11/* eslint-disable jest/valid-title */
22import MarkdownIt from "markdown-it"
3+ import { colonFencePlugin } from "markdown-it-myst-extras"
34import docutils_plugin from "../src"
45import readFixtures from "./readFixtures"
56
7+ // We have to test compatibility with colonFences here!
8+
69describe ( "Parses colonFences" , ( ) => {
710 test ( "colon fences parse" , ( ) => {
8- const mdit = MarkdownIt ( ) . use ( docutils_plugin )
11+ const mdit = MarkdownIt ( ) . use ( colonFencePlugin ) . use ( docutils_plugin )
912 const parse = mdit . parse ( `:::{tip}\nThis is a tip in a fence!\n:::` , { } )
1013 expect ( parse [ 0 ] . type ) . toBe ( "parsed_directive_open" )
1114 } )
1215 test ( "colon fences render" , ( ) => {
13- const mdit = MarkdownIt ( ) . use ( docutils_plugin )
16+ const mdit = MarkdownIt ( ) . use ( colonFencePlugin ) . use ( docutils_plugin )
1417 const rendered = mdit . render ( `:::{tip}\nfence\n:::` )
1518 expect ( rendered . trim ( ) ) . toEqual (
1619 '<aside class="admonition tip">\n<header class="admonition-title">Tip</header>\n<p>fence</p>\n</aside>'
@@ -20,7 +23,7 @@ describe("Parses colonFences", () => {
2023
2124describe ( "Parses fenced directives" , ( ) => {
2225 readFixtures ( "directives.fence" ) . forEach ( ( [ name , text , expected ] ) => {
23- const mdit = MarkdownIt ( ) . use ( docutils_plugin )
26+ const mdit = MarkdownIt ( ) . use ( colonFencePlugin ) . use ( docutils_plugin )
2427 const rendered = mdit . render ( text )
2528 it ( name , ( ) => expect ( rendered . trim ( ) ) . toEqual ( ( expected || "" ) . trim ( ) ) )
2629 } )
0 commit comments