From 646151e02081850df4b916a619540b9e3e6c735f Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Mon, 27 Aug 2018 19:12:28 +0200 Subject: [PATCH] allows compact definition lists --- browser/lib/markdown-it-deflist.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/browser/lib/markdown-it-deflist.js b/browser/lib/markdown-it-deflist.js index 5dd02267..d0cdb656 100644 --- a/browser/lib/markdown-it-deflist.js +++ b/browser/lib/markdown-it-deflist.js @@ -46,10 +46,12 @@ module.exports = function definitionListPlugin (md) { listLines, listTokIdx, max, + newEndLine, nextLine, offset, oldDDIndent, oldIndent, + oldLineMax, oldParentType, oldSCount, oldTShift, @@ -150,7 +152,16 @@ module.exports = function definitionListPlugin (md) { state.tight = true state.parentType = 'deflist' - state.md.block.tokenize(state, ddLine, endLine, true) + newEndLine = ddLine + while (++newEndLine < endLine && (state.sCount[newEndLine] >= state.sCount[ddLine] || state.isEmpty(newEndLine))) { + } + + oldLineMax = state.lineMax + state.lineMax = newEndLine + + state.md.block.tokenize(state, ddLine, newEndLine, true) + + state.lineMax = oldLineMax // If any of list item is tight, mark list as tight if (!state.tight || prevEmptyEnd) {