Work around problems related to markdown-it-texmath plugin's token.map not accounting for math_block_end.

This commit is contained in:
David Anson 2020-11-12 23:08:46 -08:00
parent a3f8fb7c62
commit 32db81b740
3 changed files with 90 additions and 0 deletions

View file

@ -271,6 +271,14 @@ module.exports.flattenLists = function flattenLists(params) {
const nestingStack = [];
let lastWithMap = { "map": [ 0, 1 ] };
params.tokens.forEach(function forToken(token) {
if (
(token.type === "math_block") &&
(token.tag === "math") &&
token.map[1]
) {
// markdown-it-texmath package does not account for math_block_end
token.map[1]++;
}
if ((token.type === "bullet_list_open") ||
(token.type === "ordered_list_open")) {
// Save current context and start a new one