From 361af34956f611b9ccb1fd6cbca8d6df7fb85d57 Mon Sep 17 00:00:00 2001 From: ibrokemypie Date: Sun, 20 Jan 2019 19:44:52 +1100 Subject: Change italic syntax to fit with other markdown implementations (#3916) currently italics require an html syntax, unlike every other formatter. this is very confusing, especially as there doesnt seem to be any documentation. this change makes both _text_ and *text* work, both things that users would expect from other implementations of markdown such as pleroma, discord and github. Add test --- src/mfm/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mfm/parser.ts b/src/mfm/parser.ts index 7dc97aa9f4..f377d18611 100644 --- a/src/mfm/parser.ts +++ b/src/mfm/parser.ts @@ -224,7 +224,7 @@ const mfm = P.createLanguage({ //#region Italic italic: r => - P.regexp(/([\s\S]+?)<\/i>/, 1) + P.regexp(/(\*|_)([a-zA-Z0-9]+?[\s\S]*?)\1/, 2) .map(x => createTree('italic', P.alt( r.bold, r.strike, -- cgit v1.2.3-freya