Skip to content
Snippets Groups Projects
Unverified Commit 9740db86 authored by syuilo's avatar syuilo
Browse files

[MFM] Better hashtag parsing: Ignore double quotation

Resolve #3886
parent 41784de9
No related branches found
No related tags found
No related merge requests found
......@@ -205,7 +205,7 @@ const mfm = P.createLanguage({
hashtag: r =>
P((input, i) => {
const text = input.substr(i);
const match = text.match(/^#([^\s\.,!\?#:]+)/i);
const match = text.match(/^#([^\s\.,!\?"#:]+)/i);
if (!match) return P.makeFailure(i, 'not a hashtag');
let hashtag = match[1];
hashtag = removeOrphanedBrackets(hashtag);
......
......@@ -365,6 +365,14 @@ describe('MFM', () => {
]);
});
it('ignore double quote', () => {
const tokens = analyze('#foo"');
assert.deepStrictEqual(tokens, [
leaf('hashtag', { hashtag: 'foo' }),
text('"'),
]);
});
it('allow including number', () => {
const tokens = analyze('#foo123');
assert.deepStrictEqual(tokens, [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment