From 4550a4459bb9fc021211e438d135d464c018ce47 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 12 Jul 2022 12:03:38 +0900 Subject: [PATCH] feat: support syntax for mfm --- CHANGELOG.md | 1 + packages/backend/src/mfm/to-html.ts | 6 ++++++ packages/client/src/components/mfm.ts | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e35a2e66..f6644f016 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ You should also include the user name that made the change. ## 12.x.x (unreleased) ### Improvements +- Support syntax for MFM ### Bugfixes - Server: Fix crash at startup if TensorFlow is not supported @mei23 diff --git a/packages/backend/src/mfm/to-html.ts b/packages/backend/src/mfm/to-html.ts index 5b382063e..bcb5c86a3 100644 --- a/packages/backend/src/mfm/to-html.ts +++ b/packages/backend/src/mfm/to-html.ts @@ -145,6 +145,12 @@ export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMenti a.textContent = node.props.content; return a; }, + + plain(node) { + const el = doc.createElement('span'); + appendChildren(node.children, el); + return el; + }, }; appendChildren(nodes, doc.body); diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts index 14ec5ffc8..16ae45bfe 100644 --- a/packages/client/src/components/mfm.ts +++ b/packages/client/src/components/mfm.ts @@ -312,6 +312,10 @@ export default defineComponent({ })]; } + case 'plain': { + return [h('span', genEl(token.children))]; + } + default: { console.error('unrecognized ast type:', token.type);