1
0
Fork 0

[v1.2.2] fix inline attr

fix utils/findOpenToken()
This commit is contained in:
sup39 2022-02-07 00:59:11 +09:00
parent 21b2b98bfb
commit 25254cb8f7
2 changed files with 5 additions and 3 deletions

View file

@ -41,10 +41,12 @@ function parseAttrs(s, re, limit=65536) {
function findOpenToken(tokens, i) {
const tokenC = tokens[i];
if (!tokenC) return null;
const {level} = tokenC;
let dlevel = 0;
for (i--; i>=0; i--) {
const token = tokens[i];
if (token.level === level) return token;
const {nesting} = token;
if (nesting === 1 && dlevel === 0) return token;
dlevel += nesting;
}
return null;
}

View file

@ -1,6 +1,6 @@
{
"name": "@sup39/markdown-it-attr",
"version": "1.2.1",
"version": "1.2.2",
"description": "A markdown-it plugin to write id, classes, and attributes",
"keywords": [
"markdown",