Skip to content

Commit 40f6141

Browse files
committed
feat(ui): style callouts like Linear and Notion callouts
GitHub-style callouts drew a colored border and a title row with the type's name. Callouts now follow Notion's and Linear's leaner look, in editing and read-only, light and dark: - a box tinted with the type's color, rounded, with no border - the type's icon in its color, in a column level with the first line - no visible title; the type's name is the icon's accessible label - a callout's paragraphs read as one box: only its outer edges are padded and rounded (new data-quote-continued mark) Clicking the icon opens the type menu, and the block handle centers on it. The title element .mbe-callout-title is now .mbe-callout-icon. The Markdown (> [!NOTE] and the other types) is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EvV4VacMo1RGCss99wn1aa
1 parent 1b10ee9 commit 40f6141

9 files changed

Lines changed: 120 additions & 56 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The same names work in `new Editor(options)` and as React props, except that Rea
6868
| `slashMenu` | `false \| string[]` | Built-in slash menu items to show, in order, or `false` for none: `text`, `heading1`, `heading2`, `heading3`, `heading4`, `bulletList`, `numberedList`, `todoList`, `quote`, `callout`, `details`, `code`, `table`, `divider`. |
6969
| `slashHint` | `boolean` | Shows `labels.slashHint` ("Type '/' for commands") in the empty paragraph that has the caret. Default `false`. No effect when `slashMenu` is `false`. When the document is a single empty paragraph, `placeholder` shows instead. |
7070
| `labels` | `Partial<Labels>` | Overrides UI strings, for localization. See `src/labels.ts`. |
71-
| `icons` | `Partial<Record<IconName, string \| Element>>` | Replaces built-in icons, which are [Lucide](https://lucide.dev) icons. A string is shown as text; an element, such as an `<svg>`, is cloned for every place it appears. Names match the `labels` keys of the same controls: the slash menu items, the block actions (`duplicate`, `delete`, the table cell actions, `altText` and `resetImageSize`), `bold`, `italic`, `strike`, `inlineCode`, `link`, `chevronDown` and `selected` (the formatting toolbar's menu buttons and their check mark), `chevronRight` (a menu row that opens a submenu, and a collapsible section's toggle), `calloutNote`, `calloutTip`, `calloutImportant`, `calloutWarning` and `calloutCaution` (callout titles and the callout menu), `openLink`, `copyLink`, `editLink` and `removeLink` (the link card), `imageAlignLeft`, `imageAlignCenter` and `imageAlignRight` (an image block's Align choices), `blockHandle` and `imageUnavailable` (shown in place of an image that did not load). |
71+
| `icons` | `Partial<Record<IconName, string \| Element>>` | Replaces built-in icons, which are [Lucide](https://lucide.dev) icons. A string is shown as text; an element, such as an `<svg>`, is cloned for every place it appears. Names match the `labels` keys of the same controls: the slash menu items, the block actions (`duplicate`, `delete`, the table cell actions, `altText` and `resetImageSize`), `bold`, `italic`, `strike`, `inlineCode`, `link`, `chevronDown` and `selected` (the formatting toolbar's menu buttons and their check mark), `chevronRight` (a menu row that opens a submenu, and a collapsible section's toggle), `calloutNote`, `calloutTip`, `calloutImportant`, `calloutWarning` and `calloutCaution` (callout icons and the callout menu), `openLink`, `copyLink`, `editLink` and `removeLink` (the link card), `imageAlignLeft`, `imageAlignCenter` and `imageAlignRight` (an image block's Align choices), `blockHandle` and `imageUnavailable` (shown in place of an image that did not load). |
7272
| `onChange` | `(markdown: string, editor) => void` | Called after document changes, at most once per animation frame. |
7373
| `onSubmit` | `(markdown: string, editor) => void` | Called on Mod+Enter or Ctrl+Enter with the current Markdown, for comment boxes and chat inputs. |
7474
| `onFocus`, `onBlur` | `(editor) => void` | Focus events. |
@@ -265,7 +265,7 @@ new Editor({
265265
});
266266
```
267267

268-
Colors are `text`, `muted`, `background`, `accent`, `link`, `codeBackground`, `border`, `popupBackground`, `popupBorder`, `hover`, `danger`, and `calloutNote`, `calloutTip`, `calloutImportant`, `calloutWarning` and `calloutCaution` (each callout type's border and title); the other tokens are `font`, `mono`, `fontSize`, `lineHeight`, `radius` and `blockGap` (numbers are pixels). Values can be any CSS, such as `var(--primary)`, so the editor can follow your app's own variables. Menus, the toolbar and the link popover take the same tokens.
268+
Colors are `text`, `muted`, `background`, `accent`, `link`, `codeBackground`, `border`, `popupBackground`, `popupBorder`, `hover`, `danger`, and `calloutNote`, `calloutTip`, `calloutImportant`, `calloutWarning` and `calloutCaution` (each callout type's icon, and a light tint of it behind the text); the other tokens are `font`, `mono`, `fontSize`, `lineHeight`, `radius` and `blockGap` (numbers are pixels). Values can be any CSS, such as `var(--primary)`, so the editor can follow your app's own variables. Menus, the toolbar and the link popover take the same tokens.
269269

270270
`colorScheme` picks light or dark: `auto` (the default) follows `prefers-color-scheme`, or `data-theme="light"` or `data-theme="dark"` on the editor or an ancestor; `light` and `dark` force one; `inherit` follows the page's `color-scheme`, for apps that switch it themselves. Switching tokens or the scheme with `setOptions({ theme })` re-renders nothing.
271271

@@ -336,7 +336,7 @@ A callout is a quote with a type, saved as a [GitHub alert](https://docs.github.
336336
> Back up your data first.
337337
```
338338

339-
The types are Note, Tip, Important, Warning and Caution. A callout shows its type's icon and name above the text, with the type's color on its border. Make one with Callout in the slash menu (a Note), or type `[!tip] ` at the start of a paragraph or a quote. Enter adds a line to the callout; Enter on an empty line ends it. Clicking the title, or Mod+/ inside the callout, opens its menu: the five types, and Delete for the whole callout. Pasting an alert copied from a GitHub page keeps it a callout. Renderers without alert support, including CommonMark, show a plain quote whose first line is `[!WARNING]`.
339+
The types are Note, Tip, Important, Warning and Caution. A callout is a softly tinted box in its type's color, with the type's icon beside the first line; the type's name is the icon's accessible label. Make one with Callout in the slash menu (a Note), or type `[!tip] ` at the start of a paragraph or a quote. Enter adds a line to the callout; Enter on an empty line ends it. Clicking the icon, or Mod+/ inside the callout, opens its menu: the five types, and Delete for the whole callout. Pasting an alert copied from a GitHub page keeps it a callout. Renderers without alert support, including CommonMark, show a plain quote whose first line is `[!WARNING]`.
340340

341341
## Collapsible sections
342342

0 commit comments

Comments
 (0)