mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Empty inline BBCodes were broken (#18276)
Upgrading to Markdown.it v13 broke empty inline BBCodes. This works around the problem by adding an empty token before a closing token if the previous token was a BBCode token. It also removes the unused `jump` attribute which was removed in Markdown.it v12.3
This commit is contained in:
@@ -61,6 +61,10 @@ function tokenizeBBCode(state, silent, ruler) {
|
||||
} else {
|
||||
tagInfo.rule = rule;
|
||||
|
||||
if (tagInfo.closing && state.tokens.at(-1)?.meta === "bbcode") {
|
||||
state.push("text", "", 0);
|
||||
}
|
||||
|
||||
let token = state.push("text", "", 0);
|
||||
token.content = state.src.slice(pos, pos + tagInfo.length);
|
||||
token.meta = "bbcode";
|
||||
@@ -73,7 +77,6 @@ function tokenizeBBCode(state, silent, ruler) {
|
||||
token: state.tokens.length - 1,
|
||||
level: state.level,
|
||||
end: -1,
|
||||
jump: 0,
|
||||
});
|
||||
|
||||
state.pos = pos + tagInfo.length;
|
||||
|
||||
Reference in New Issue
Block a user