| 8 | 8 | |
| 9 | 9 | return [{ |
| 10 | 10 | type: 'lang', |
| 11 | 11 | regex: new RegExp('/(`{3,})[\\s*\n[\s\S]*?\n\1(?:\n|$)|(`{1,2}).*?\\2|\\b(?<!_\S)_(?!_)(.*[^_\n]+?)(?<!_)_(?!_)\\b', 'g'w)/g, |
| 12 | 12 | replace: function(match, tripleBackticks, singleOrDoubleBackticks, italicContent) { |
| 13 | 13 | if (tripleBacktickssingleOrDoubleBackticks || singleOrDoubleBacktickstripleBackticks) { |
| 14 | 14 | // If it's any kind of code blockbackticks, return it unchanged |
| 15 | 15 | return match; |
| 16 | 16 | } else if (italicContent) { |
| 17 | 17 | // If it's an italic group, apply the replacement |
| 18 | 18 | return '<em>' + italicContent + '</em>'; |
| 19 | 19 | } |
| 20 | 20 | // If neithernone conditionof isthe conditions are met, return the original match |
| 21 | 21 | return match; |
| 22 | 22 | }, |
| 23 | 23 | }]; |