mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-03 04:37:40 +01:00
Fix for old iOS
This commit is contained in:
parent
b9392893dc
commit
2a5c240399
@ -1,15 +1,20 @@
|
||||
// Showdown extension that replaces words surrounded by singular underscores with <em> tags
|
||||
export const markdownUnderscoreExt = () => {
|
||||
if (!canUseNegativeLookbehind()) {
|
||||
console.log('Showdown-underscore extension: Negative lookbehind not supported. Skipping.');
|
||||
try {
|
||||
if (!canUseNegativeLookbehind()) {
|
||||
console.log('Showdown-underscore extension: Negative lookbehind not supported. Skipping.');
|
||||
return [];
|
||||
}
|
||||
|
||||
return [{
|
||||
type: 'lang',
|
||||
regex: new RegExp('\\b(?<!_)_(?!_)(.*?)(?<!_)_(?!_)\\b', 'g'),
|
||||
replace: '<em>$1</em>',
|
||||
}];
|
||||
} catch (e) {
|
||||
console.error('Error in Showdown-underscore extension:', e);
|
||||
return [];
|
||||
}
|
||||
|
||||
return [{
|
||||
type: 'lang',
|
||||
regex: /\b(?<!_)_(?!_)(.*?)(?<!_)_(?!_)\b/g,
|
||||
replace: '<em>$1</em>',
|
||||
}];
|
||||
};
|
||||
|
||||
function canUseNegativeLookbehind() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user