You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For input [AA homer.j.simpson@example.com BB](mailto:homer.j.simpson@example.com)link_open and link_close tokens have different levels. I think it may be a bug, otherwise, please, explain it to me why they have different levels.
Markdown-it version: 8.4.1.
'use strict';constmd=require('markdown-it')();md.core.ruler.push('buggy_levels',(state)=>{constblockTokens=state.tokens;for(letj=0,l=blockTokens.length;j<l;j++){if(!(blockTokens[j].type==='inline'&&blockTokens[j].content.includes('@'))){continue;}consttokens=blockTokens[j].children;console.log('LOOK AT LEVELS:',tokens.map((t)=>[t.type,t.level]));for(leti=tokens.length-1;i>=0;--i){if(tokens[i].type!=='link_close'){continue;}constlinkCloseToken=tokens[i];constlinkCloseIndex=i;do{--i;}while(!(tokens[i].level===linkCloseToken.level&&tokens[i].type==='link_open'));if(!tokens[i].attrGet('href').startsWith('mailto:')){continue;}console.log('NO BUG ANYMORE!');}}});constinput='[AA homer.j.simpson@example.com BB](mailto:homer.j.simpson@example.com)';console.log(md.render(input));
For input
[AA homer.j.simpson@example.com BB](mailto:homer.j.simpson@example.com)
link_open
andlink_close
tokens have different levels. I think it may be a bug, otherwise, please, explain it to me why they have different levels.Markdown-it version: 8.4.1.
Online demo on RunKit
The text was updated successfully, but these errors were encountered: