Add support for arbitrary indent when w/o codeIntended
Related-to: facebook/docusaurus#10305.
This commit is contained in:
parent
c33a6406b8
commit
521612a6a8
2 changed files with 18 additions and 2 deletions
|
@ -197,12 +197,14 @@ function tokenizeDirectiveContainer(effects, ok, nok) {
|
||||||
*/
|
*/
|
||||||
function tokenizeClosingFence(effects, ok, nok) {
|
function tokenizeClosingFence(effects, ok, nok) {
|
||||||
let size = 0
|
let size = 0
|
||||||
|
assert(self.parser.constructs.disable.null, 'expected `disable.null`')
|
||||||
return factorySpace(
|
return factorySpace(
|
||||||
effects,
|
effects,
|
||||||
closingPrefixAfter,
|
closingPrefixAfter,
|
||||||
types.linePrefix,
|
types.linePrefix,
|
||||||
constants.tabSize
|
self.parser.constructs.disable.null.includes('codeIndented')
|
||||||
|
? undefined
|
||||||
|
: constants.tabSize
|
||||||
)
|
)
|
||||||
|
|
||||||
/** @type {State} */
|
/** @type {State} */
|
||||||
|
|
|
@ -993,6 +993,20 @@ test('micromark-extension-directive (syntax, container)', async function (t) {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await t.test(
|
||||||
|
'should strip arbitrary length prefix from closing fence line (codeIndented disabled)',
|
||||||
|
async function () {
|
||||||
|
assert.equal(
|
||||||
|
micromark(':::x\nalpha.\n :::\n\nbravo.', {
|
||||||
|
allowDangerousHtml: true,
|
||||||
|
extensions: [directive(), {disable: {null: ['codeIndented']}}],
|
||||||
|
htmlExtensions: [directiveHtml()]
|
||||||
|
}),
|
||||||
|
'<p>bravo.</p>'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
await t.test(
|
await t.test(
|
||||||
'should support a block quote after a container',
|
'should support a block quote after a container',
|
||||||
async function () {
|
async function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue