Skip to content

Commit

Permalink
Add support for arbitrary indent when w/o codeIntended
Browse files Browse the repository at this point in the history
Closes: GH-1.
Related-to: GH-2.
Closes GH-3.

Reviewed-by: Titus Wormer <[email protected]>
  • Loading branch information
tumidi authored May 11, 2023
1 parent 0983f46 commit 65eaae7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dev/lib/math-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ function tokenizeMathFenced(effects, ok, nok) {
effects,
beforeSequenceClose,
types.linePrefix,
constants.tabSize
self.parser.constructs.disable.null.includes('codeIndented')
? undefined
: constants.tabSize
)

/**
Expand Down
11 changes: 11 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,17 @@ test('markdown -> html (micromark)', () => {
'should strip the prefix of the opening fence from content lines'
)

assert.equal(
micromark(' $$\n a\n $$', {
extensions: [syntax(), {disable: {null: ['codeIndented']}}],
htmlExtensions: [html()]
}),
'<div class="math math-display">' +
renderToString('a', {displayMode: true}) +
'</div>',
'should strip arbitrary length prefix from closing fence line (codeIndented disabled)'
)

assert.equal(
micromark('> $$\n> a\n> $$\n> b', {
extensions: [syntax()],
Expand Down

0 comments on commit 65eaae7

Please sign in to comment.