[MFM] Better hashtag parsing
This commit is contained in:
25
test/mfm.ts
25
test/mfm.ts
@ -212,12 +212,37 @@ describe('Text', () => {
|
||||
], tokens);
|
||||
});
|
||||
|
||||
it('with brackets', () => {
|
||||
const tokens = analyze('(#foo)');
|
||||
assert.deepEqual([
|
||||
text('('),
|
||||
node('hashtag', { hashtag: 'foo' }),
|
||||
text(')'),
|
||||
], tokens);
|
||||
});
|
||||
|
||||
it('with brackets (space before)', () => {
|
||||
const tokens = analyze('(bar #foo)');
|
||||
assert.deepEqual([
|
||||
text('(bar '),
|
||||
node('hashtag', { hashtag: 'foo' }),
|
||||
text(')'),
|
||||
], tokens);
|
||||
});
|
||||
|
||||
it('disallow number only', () => {
|
||||
const tokens = analyze('#123');
|
||||
assert.deepEqual([
|
||||
text('#123'),
|
||||
], tokens);
|
||||
});
|
||||
|
||||
it('disallow number only (with brackets)', () => {
|
||||
const tokens = analyze('(#123)');
|
||||
assert.deepEqual([
|
||||
text('(#123)'),
|
||||
], tokens);
|
||||
});
|
||||
});
|
||||
|
||||
describe('quote', () => {
|
||||
|
Reference in New Issue
Block a user