mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 01:54:43 +03:00
tokenizeMessage: fix URLs inside inline codeblocks
Fixes urbit/landscape#699
This commit is contained in:
parent
eedef4ea1a
commit
edf6456d6c
@ -58,13 +58,7 @@ const tokenizeMessage = (text) => {
|
|||||||
|| (str === '`' && !isInCodeBlock)
|
|| (str === '`' && !isInCodeBlock)
|
||||||
) {
|
) {
|
||||||
isInCodeBlock = true;
|
isInCodeBlock = true;
|
||||||
} else if (
|
|
||||||
(str.endsWith('`') && str !== '`')
|
|
||||||
|| (str === '`' && isInCodeBlock)
|
|
||||||
) {
|
|
||||||
isInCodeBlock = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isRef(str) && !isInCodeBlock) {
|
if(isRef(str) && !isInCodeBlock) {
|
||||||
if (currTextLine.length > 0 || currTextBlock.length > 0) {
|
if (currTextLine.length > 0 || currTextBlock.length > 0) {
|
||||||
// If we're in the middle of a message, add it to the stack and reset
|
// If we're in the middle of a message, add it to the stack and reset
|
||||||
@ -105,6 +99,13 @@ const tokenizeMessage = (text) => {
|
|||||||
} else {
|
} else {
|
||||||
currTextLine.push(str);
|
currTextLine.push(str);
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
(str.endsWith('`') && str !== '`')
|
||||||
|
|| (str === '`' && isInCodeBlock)
|
||||||
|
) {
|
||||||
|
isInCodeBlock = false;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
currTextBlock.push(currTextLine.join(' '))
|
currTextBlock.push(currTextLine.join(' '))
|
||||||
|
Loading…
Reference in New Issue
Block a user