'use client' import { Mark, mergeAttributes } from '@tiptap/core' export function createHtmlMark(name: string, tag: 'kbd' | 'sub' | 'sup') { return Mark.create({ name, parseHTML() { return [{ tag }] }, renderHTML({ HTMLAttributes }) { return [tag, mergeAttributes(HTMLAttributes), 0] }, markdownOptions: { htmlReopen: { open: `<${tag}>`, close: `` } }, renderMarkdown: (node, helpers) => { return `<${tag}>${helpers.renderChildren(node)}` } }) }