[MFM] Better hashtag parsing
This commit is contained in:
parent
02b07c1b5b
commit
3b10e93efe
2 changed files with 46 additions and 3 deletions
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', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue