Fix MFM strike parsing

This commit is contained in:
syuilo 2019-06-16 21:42:57 +09:00
parent 57a7155cbb
commit 4c9b953d65
2 changed files with 9 additions and 1 deletions

View file

@ -104,7 +104,7 @@ export const mfmLanguage = P.createLanguage({
return P.alt(xml, underscore).map(x => createTree('italic', r.inline.atLeast(1).tryParse(x), {}));
},
strike: r => P.regexp(/~~(.+?)~~/, 1).map(x => createTree('strike', r.inline.atLeast(1).tryParse(x), {})),
strike: r => P.regexp(/~~([^\n~]+?)~~/, 1).map(x => createTree('strike', r.inline.atLeast(1).tryParse(x), {})),
motion: r => {
const paren = P.regexp(/\(\(\(([\s\S]+?)\)\)\)/, 1);
const xml = P.regexp(/<motion>(.+?)<\/motion>/, 1);

View file

@ -1116,6 +1116,14 @@ describe('MFM', () => {
], {}),
]);
});
// https://misskey.io/notes/7u1kv5dmia
it('ignore internal tilde', () => {
const tokens = parse('~~~~~');
assert.deepStrictEqual(tokens, [
text('~~~~~')
]);
});
});
describe('italic', () => {