Fix MFM strike parsing

This commit is contained in:
syuilo 2019-06-16 21:42:57 +09:00
parent af60b45ee7
commit 63c659bc8f
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
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', () => {