Fix MFM italic parsing

This commit is contained in:
syuilo 2019-06-16 21:30:51 +09:00
parent 96875b17d2
commit 57a7155cbb

View File

@ -98,7 +98,7 @@ export const mfmLanguage = P.createLanguage({
const text = input.substr(i);
const match = text.match(/^(\*|_)([a-zA-Z0-9]+?[\s\S]*?)\1/);
if (!match) return P.makeFailure(i, 'not a italic');
if (input[i - 1] != null && input[i - 1].match(/[a-z0-9]/i)) return P.makeFailure(i, 'not a italic');
if (input[i - 1] != null && input[i - 1] != ' ' && input[i - 1] != '\n') return P.makeFailure(i, 'not a italic');
return P.makeSuccess(i + match[0].length, match[2]);
});