Files
bilin/src/renderer/extensions/landmark-mark.ts
T
bing aac51bf183 feat: deliver P2 v0.2.0 with unified editor, search, and snapshots
Implement schema v2 migration, outline/setting/inspiration CRUD, unified TipTap editing, reference panel with mentions, FTS global search, chapter version history, writing landmarks, word frequency analysis, light theme contrast fixes, and full unit/E2E test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 14:13:27 +08:00

28 lines
613 B
TypeScript

import { Mark, mergeAttributes } from '@tiptap/core'
export const LandmarkMark = Mark.create({
name: 'landmark',
inclusive: true,
addAttributes() {
return {
label: { default: '' },
landmarkType: { default: 'todo' }
}
},
parseHTML() {
return [{ tag: 'span[data-landmark]' }]
},
renderHTML({ HTMLAttributes }) {
const label = HTMLAttributes.label ?? ''
return [
'span',
mergeAttributes(HTMLAttributes, {
'data-landmark': 'true',
class: 'landmark-mark',
'data-testid': 'landmark-mark'
}),
`[TODO: ${label}]`
]
}
})