Skip to content

Commit ba3d92a

Browse files
committed
fix regex for line-through and italic formats
1 parent 335ac00 commit ba3d92a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/markupParser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,10 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
285285
tag = tag.replace(/\*([^*]*)\*/g, "<strong>$1</strong>");
286286
// line-through
287287
if ((!html_tag) && (!tag.match('<img')) && (!listFlag)) {
288-
tag = tag.replace(/\B-([^-]*)-\B/g, " <span style='text-decoration: line-through;'>$1</span> ");
289-
tag = tag.replace(/_([^_]*)_/g, "<i>$1</i>");
288+
// tag = tag.replace(/\B-([^-]*)-\B/g, " <span style='text-decoration: line-through;'>$1</span> ");
289+
// tag = tag.replace(/_([^_]*)_/g, "<i>$1</i>");
290+
tag = tag.replace(/\B-((\([^)]*\)|{[^}]*}|\[[^]]+\]){0,3})(\S.*?\S|\S)-\B/g," <span style='text-decoration: line-through;'>$3</span> ");
291+
tag = tag.replace(/(?:\b)_((\([^)]*\)|{[^}]*}|\[[^]]+\]){0,3})(\S.*?\S|\S)_(?:\b)/g, "<i>$3</i>");
290292
}
291293
} else {
292294
if (tag !== `<pre><code style='font-family: ${MONOSPACE_FONT_FAMILY}'>`) {

0 commit comments

Comments
 (0)