Fix for old iOS
This commit is contained in:
parent
b9392893dc
commit
2a5c240399
|
@ -1,5 +1,6 @@
|
||||||
// Showdown extension that replaces words surrounded by singular underscores with <em> tags
|
// Showdown extension that replaces words surrounded by singular underscores with <em> tags
|
||||||
export const markdownUnderscoreExt = () => {
|
export const markdownUnderscoreExt = () => {
|
||||||
|
try {
|
||||||
if (!canUseNegativeLookbehind()) {
|
if (!canUseNegativeLookbehind()) {
|
||||||
console.log('Showdown-underscore extension: Negative lookbehind not supported. Skipping.');
|
console.log('Showdown-underscore extension: Negative lookbehind not supported. Skipping.');
|
||||||
return [];
|
return [];
|
||||||
|
@ -7,9 +8,13 @@ export const markdownUnderscoreExt = () => {
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
type: 'lang',
|
type: 'lang',
|
||||||
regex: /\b(?<!_)_(?!_)(.*?)(?<!_)_(?!_)\b/g,
|
regex: new RegExp('\\b(?<!_)_(?!_)(.*?)(?<!_)_(?!_)\\b', 'g'),
|
||||||
replace: '<em>$1</em>',
|
replace: '<em>$1</em>',
|
||||||
}];
|
}];
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error in Showdown-underscore extension:', e);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function canUseNegativeLookbehind() {
|
function canUseNegativeLookbehind() {
|
||||||
|
|
Loading…
Reference in New Issue