documint 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -125,3 +125,22 @@ export function App() {
125
125
  return <Documint content={content} onContentChanged={setContent} storage={storage} />;
126
126
  }
127
127
  ```
128
+
129
+ ## Text Decorations
130
+
131
+ Use the `decorations` prop to style text that matches host-provided regular expressions. Decorations are worker-derived presentation ranges, update asynchronously as content changes, and are not serialized back to markdown. Link text keeps the theme link color when it overlaps a text-color decoration.
132
+
133
+ ```tsx
134
+ import { useState } from "react";
135
+ import { Documint, type DocumintDecoration } from "documint";
136
+
137
+ const decorations: readonly DocumintDecoration[] = [
138
+ { pattern: /\blist\b/gi, color: "red", backgroundColor: "rgba(255, 0, 0, 0.12)" },
139
+ ];
140
+
141
+ export function App() {
142
+ const [content, setContent] = useState("A list of things");
143
+
144
+ return <Documint content={content} onContentChanged={setContent} decorations={decorations} />;
145
+ }
146
+ ```
package/dist/index.d.ts CHANGED
@@ -205,12 +205,18 @@ export type EditorKeybinding = {
205
205
  shiftKey?: boolean | "any";
206
206
  };
207
207
  export declare const defaultKeybindings: EditorKeybinding[];
208
+ export type DocumintDecoration = {
209
+ backgroundColor?: string;
210
+ color?: string;
211
+ pattern: RegExp;
212
+ };
208
213
  export type DocumintProps = {
209
214
  content: string;
210
215
  className?: string;
211
216
  actions?: DocumintActions;
212
217
  theme?: DocumintTheme;
213
218
  keybindings?: EditorKeybinding[];
219
+ decorations?: readonly DocumintDecoration[];
214
220
  presence?: DocumentPresence[];
215
221
  storage?: DocumintStorage;
216
222
  users?: DocumentUser[];