Open Andarist opened 5 years ago
If function tag could be changed to something like this
function tag(token) {
var desc = TAGS[token.replace(/\*/g,'_')[1] || ''],
index = context.indexOf(token),
end = ~index && 1;
if (!desc) return token;
if (!desc[1]) return desc[0];
end ? context.splice(index, 1) : context.push(token)
return desc[end];
}
it helps in the case.
As a result for an input ***hello***
it would be <strong><em>hello</strong></em>
and browsers are smart enough to resolve such cases.
input
actual
expected https://babelmark.github.io/?text=***hello***
And one other, even weirder, case (heading being nested inside formatting from the previous line)
input
actual
expected https://babelmark.github.io/?text=***hello***%0A%0A%23%23+Heading