From bfd60525617832ae202c5a665d3b9d6fd5267539 Mon Sep 17 00:00:00 2001 From: marihachi Date: Fri, 22 Jul 2022 22:56:57 +0900 Subject: [PATCH 1/6] changelog --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54cc50c..4e8e13c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,8 +35,6 @@ ## 0.22.0 -npm: https://www.npmjs.com/package/mfm-js/v/0.22.0 - ### Features - Unicode emoji supports Unicode 14.0 emoji (#109) From 4165a59fdb19f52c80e199e0d000dcac4d4cb02a Mon Sep 17 00:00:00 2001 From: marihachi Date: Fri, 22 Jul 2022 22:57:10 +0900 Subject: [PATCH 2/6] update package.json --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index bc53c3c..a71ad89 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "twemoji-parser": "14.0.0" }, "files": [ - "built" + "built", + "CONTRIBUTING.md" ] } From 073b69a4f2caaa16fba73082fc07d32dda678c77 Mon Sep 17 00:00:00 2001 From: marihachi Date: Fri, 22 Jul 2022 22:58:00 +0900 Subject: [PATCH 3/6] update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a71ad89..2a6ede8 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,6 @@ }, "files": [ "built", - "CONTRIBUTING.md" + "CHANGELOG.md" ] } From 363b091a67b5cc55aa0dc791712008040e884603 Mon Sep 17 00:00:00 2001 From: marihachi Date: Tue, 20 Dec 2022 11:16:35 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BB=95=E6=A7=98=E3=81=AB=E5=87=BA?= =?UTF-8?q?=E3=81=A6=E3=81=8F=E3=82=8B=E7=94=A8=E8=AA=9E=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/syntax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/syntax.md b/docs/syntax.md index 529bfe2..29ae576 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -546,7 +546,7 @@ silent=true ``` ## 詳細 -- リンクラベルには再度InlineParserを適用する。ただし、リンクラベルではURL、リンク、メンションは使用できない。 +- 表示テキストには再度InlineParserを適用する。ただし、表示テキストではURL、リンク、メンションは使用できない。 ## ノード ```js From 013f3af23e74b6ac22b91a3b500c248520f9eb34 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 9 Jan 2023 16:05:16 +0900 Subject: [PATCH 5/6] improve emoji code parsing Fix #129 --- src/internal/parser.ts | 5 ++++- test/parser.ts | 14 +++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/internal/parser.ts b/src/internal/parser.ts index 3cca5ea..3d1a04f 100644 --- a/src/internal/parser.ts +++ b/src/internal/parser.ts @@ -626,12 +626,15 @@ export const language = P.createLanguage({ }, emojiCode: r => { + const side = P.notMatch(P.regexp(/[a-z0-9]/i)); const mark = P.str(':'); return P.seq([ + P.alt([P.lineBegin, side]), mark, P.regexp(/[a-z0-9_+-]+/i), mark, - ], 1).map(name => M.EMOJI_CODE(name as string)); + P.alt([P.lineEnd, side]), + ], 2).map(name => M.EMOJI_CODE(name as string)); }, link: r => { diff --git a/test/parser.ts b/test/parser.ts index 6a2393f..77a7a41 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -34,7 +34,19 @@ describe('SimpleParser', () => { it('between texts', () => { const input = 'foo:bar:baz'; - const output = [TEXT('foo'), EMOJI_CODE('bar'), TEXT('baz')]; + const output = [TEXT('foo:bar:baz')]; + assert.deepStrictEqual(mfm.parseSimple(input), output); + }); + + it('between texts 2', () => { + const input = '12:34:56'; + const output = [TEXT('12:34:56')]; + assert.deepStrictEqual(mfm.parseSimple(input), output); + }); + + it('between texts 3', () => { + const input = 'あ:bar:い'; + const output = [TEXT('あ'), EMOJI_CODE('bar'), TEXT('い')]; assert.deepStrictEqual(mfm.parseSimple(input), output); }); }); From 8915998c02936827bd055b9c839638609a6fafb5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 9 Jan 2023 16:06:07 +0900 Subject: [PATCH 6/6] 0.23.1 --- CHANGELOG.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e8e13c..ee44cc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ --> +## 0.23.1 +### Improvements +- improve emoji code parsing + ## 0.23.0 ### Features diff --git a/package-lock.json b/package-lock.json index 48e2837..423e834 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mfm-js", - "version": "0.23.0", + "version": "0.23.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mfm-js", - "version": "0.23.0", + "version": "0.23.1", "license": "MIT", "dependencies": { "twemoji-parser": "14.0.0" diff --git a/package.json b/package.json index 2a6ede8..d79f770 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mfm-js", - "version": "0.23.0", + "version": "0.23.1", "description": "An MFM parser implementation with TypeScript", "main": "./built/index.js", "types": "./built/index.d.ts",