Typography extension for Tiptap that automatically converts common text input patterns into proper typographic characters.
73
Build a Tiptap editor extension that provides a highlight mark with custom interactive rendering using React. The highlight mark should display a clickable badge that allows users to change the highlight color.
Create a custom Tiptap mark extension with the following features:
Highlight Mark Definition: Define a mark that applies a colored background to text
color attribute that stores the highlight colorCustom Mark View Rendering: Implement custom rendering for the highlight mark using React
Interactive Color Update: When the badge is clicked, cycle to the next color
Mark Commands: Implement two essential commands:
setHighlight({ color }) - Apply highlight with the specified color to current selectionunsetHighlight() - Remove highlight from current selectionsetHighlight({ color: 'yellow' }) is executed, the text has a yellow background (#ffeb3b) @testsetHighlight({ color: 'green' }) is executed on selected text, the text has a green background (#4caf50) @testunsetHighlight() is executed on highlighted text, the highlight is removed @test@generates
import { Mark } from '@tiptap/core';
/**
* Interactive Highlight mark extension that renders with a clickable color badge
*/
export const InteractiveHighlight: Mark;Provides the core Tiptap editor functionality and mark extension base class.
Provides React integration and ReactMarkViewRenderer for custom mark rendering.
Provides basic editor extensions for a functional editor.
Provides React framework for building interactive components.
Provides React DOM rendering capabilities.
Install with Tessl CLI
npx tessl i tessl/npm-tiptap--extension-typographydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10