mobiledoc-kit
mobiledoc-kit copied to clipboard
Error in the order of markup opening
I am tesing my renderer, and seem to have uncovered an error, in at a bare minimum, your demo site - have yet not tested standalone
MCVE:
Writing "Hello world", with Hello in bold, and from the o in Hello, to the end of the string also italicized, gives this mobiledoc:
{
"version": "0.3.1",
"atoms": [],
"cards": [],
"markups": [
[
"strong"
],
[
"em"
]
],
"sections": [
[
1,
"p",
[
[
0,
[
0
],
1,
"Hell"
],
[
0,
[
1,
0
],
1,
"o"
],
[
0,
[],
1,
" world"
]
]
]
]
}
The error is in the opened markups of
[
0,
[
1,
0
],
1,
"o"
],
As it is this way, and markups are closed in the order of opening, the em tag gets closed first and the "world" part of the text remains bold, not italic.. Manually swapping the 1 and 0 there causes a correct output.
I think you are probably reading the diff wrong.
The example with the error reads as follows:
- add markup
1
(em
) on the stack (Stack:em
) - add markup
0
(strong
) on the stack (Stack:em > strong
) - render text (Stack:
em > strong
) - close 1 markup, which is
strong
as it is at the top of the stack (Stack:em
).
Which looks correct to me?
This is working correctly