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:
Acid Chicken (硫酸鶏) 2019-03-14 21:23:15 +09:00 committed by GitHub
parent 0f65b1bcc5
commit 38656103c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 37 additions and 13 deletions

View file

@ -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', () => {