Closed arve0 closed 5 years ago
Note that div and p both have nesting === 1, which is incorrect, as p is inside div.
It is correct. Nesting does not represent a level of nesting, it represent a change of level of nesting.
See here for more details.
I believe what you are looking for is level
property which is hidden behind …
in your dump.
Full dump of tokens:
[ Token {
type: 'container_column_open',
tag: 'div',
attrs: null,
map: [ 1, 3 ],
nesting: 1,
level: 0,
children: null,
content: '',
markup: ':::',
info: ' column',
meta: null,
block: true,
hidden: false },
Token {
type: 'paragraph_open',
tag: 'p',
attrs: null,
map: [ 2, 3 ],
nesting: 1,
level: 1,
children: null,
content: '',
markup: '',
info: '',
meta: null,
block: true,
hidden: false },
Token {
type: 'inline',
tag: '',
attrs: null,
map: [ 2, 3 ],
nesting: 0,
level: 2,
children: [ [Token] ],
content: 'Lorem ipsum',
markup: '',
info: '',
meta: null,
block: true,
hidden: false },
Token {
type: 'paragraph_close',
tag: 'p',
attrs: null,
map: null,
nesting: -1,
level: 1,
children: null,
content: '',
markup: '',
info: '',
meta: null,
block: true,
hidden: false },
Token {
type: 'container_column_close',
tag: 'div',
attrs: null,
map: null,
nesting: -1,
level: 0,
children: null,
content: '',
markup: ':::',
info: '',
meta: null,
block: true,
hidden: false } ]
To reproduce:
gives tokens:
Note that
div
andp
both havenesting === 1
, which is incorrect, asp
is insidediv
.This results in https://github.com/arve0/markdown-it-attrs/issues/72, attributes on the wrong opening tag.