Skip to content

Commit 5242c08

Browse files
committed
fix: render button nodes
resolves #379
1 parent 918ae96 commit 5242c08

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/runtime/stringify/mdc-remark.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,21 @@ const mdcRemarkHandlers: Record<string, (state: State, node: Parents) => unknown
220220
meta
221221
}
222222
},
223+
button: (state: State, node: Parents) => {
224+
if (
225+
// @ts-expect-error: custom type
226+
node.children?.find(child => child.type === mdcRemarkElementType)
227+
|| node.children?.find(child => child.type === 'text' && child.value.includes('\n'))
228+
) {
229+
return {
230+
type: 'containerComponent',
231+
name: 'button',
232+
children: state.all(node),
233+
attributes: node.properties
234+
}
235+
}
236+
return createTextComponent('button')(state, node)
237+
},
223238
span: createTextComponent('span'),
224239
binding: createTextComponent('binding'),
225240
iframe: createTextComponent('iframe'),

0 commit comments

Comments
 (0)