tokenizeMessage: fix URLs inside inline codeblocks

Fixes urbit/landscape#699
This commit is contained in:
Liam Fitzgerald 2021-05-10 14:38:23 +10:00
parent eedef4ea1a
commit edf6456d6c
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -58,13 +58,7 @@ const tokenizeMessage = (text) => {
|| (str === '`' && !isInCodeBlock)
) {
isInCodeBlock = true;
} else if (
(str.endsWith('`') && str !== '`')
|| (str === '`' && isInCodeBlock)
) {
isInCodeBlock = false;
}
if(isRef(str) && !isInCodeBlock) {
if (currTextLine.length > 0 || currTextBlock.length > 0) {
// If we're in the middle of a message, add it to the stack and reset
@ -105,6 +99,13 @@ const tokenizeMessage = (text) => {
} else {
currTextLine.push(str);
}
if (
(str.endsWith('`') && str !== '`')
|| (str === '`' && isInCodeBlock)
) {
isInCodeBlock = false;
}
});
}
currTextBlock.push(currTextLine.join(' '))