From 2650eca7a122c6e9748b3077b0bcc266d55a5251 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 7 Nov 2018 21:17:27 +0900 Subject: [PATCH] [MFM] Fix title parsing --- src/mfm/parse/elements/title.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mfm/parse/elements/title.ts b/src/mfm/parse/elements/title.ts index c91ed86e6..d67236aa7 100644 --- a/src/mfm/parse/elements/title.ts +++ b/src/mfm/parse/elements/title.ts @@ -11,10 +11,9 @@ export type TextElementTitle = { export default function(text: string, isBegin: boolean) { const match = isBegin ? text.match(/^(【|\[)(.+?)(】|])\n/) : text.match(/^\n(【|\[)(.+?)(】|])\n/); if (!match) return null; - const title = match[0]; return { type: 'title', - content: title, - title: title.substr(1, title.length - 3) + content: match[0], + title: match[2] } as TextElementTitle; }