Add angle bracket covered url syntax to mfm (#4483)
* Add angle bracket covered url syntax to mfm * Fix path * Fix match * Fix index
This commit is contained in:
parent
0f65b1bcc5
commit
38656103c0
10 changed files with 37 additions and 13 deletions
16
test/mfm.ts
16
test/mfm.ts
|
@ -12,7 +12,7 @@ import * as assert from 'assert';
|
|||
|
||||
import { parse, parsePlain } from '../src/mfm/parse';
|
||||
import { toHtml } from '../src/mfm/toHtml';
|
||||
import { createTree as tree, createLeaf as leaf, MfmTree } from '../src/mfm/types';
|
||||
import { createTree as tree, createLeaf as leaf, MfmTree } from '../src/mfm/prelude';
|
||||
import { removeOrphanedBrackets } from '../src/mfm/language';
|
||||
|
||||
function text(text: string): MfmTree {
|
||||
|
@ -840,6 +840,20 @@ describe('MFM', () => {
|
|||
text(')')
|
||||
]);
|
||||
});
|
||||
|
||||
it('ignore non-ascii characters contained url without angle brackets', () => {
|
||||
const tokens = parse('https://大石泉すき.example.com');
|
||||
assert.deepStrictEqual(tokens, [
|
||||
text('https://大石泉すき.example.com')
|
||||
]);
|
||||
});
|
||||
|
||||
it('match non-ascii characters contained url with angle brackets', () => {
|
||||
const tokens = parse('<https://大石泉すき.example.com>');
|
||||
assert.deepStrictEqual(tokens, [
|
||||
leaf('url', { url: 'https://大石泉すき.example.com' })
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('link', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue