@usememos/editor 26.10.27 → 26.10.29

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
@@ -63,6 +63,7 @@ The same names work in `new Editor(options)` and as React props, except that Rea
63
63
  | `headingIds` | `(headings) => (string \| undefined)[]` | Element ids for headings, for in-page links and an outline. Called with every heading's `{ text, level }` in order, again when the document changes. |
64
64
  | `codeCopy` | `boolean` | A copy button at the end of each code block's bar, shown on hover or focus, that copies the code. Default `true`. Its text is `labels.copyCode` and `labels.copied`, its icons `icons.copyCode` and `icons.copied`. |
65
65
  | `referrerPolicy` | `ReferrerPolicy` | `referrerpolicy` for images, such as `no-referrer`. Images always load lazily. |
66
+ | `sanitizeHtml` | `(tree, { kind, editor }) => Node \| null \| Promise` | Renders raw HTML. Without it, HTML blocks and inline HTML show as their source: the editor renders no HTML on its own. See [Raw HTML](#raw-html). |
66
67
  | `onLinkClick` | `({ editor, href, event }) => boolean` | Called when a link is clicked to be opened: a plain click while read-only, Mod+click while editing, or Open on the link card. Return `true` to handle it, for example to route an in-app link or scroll to an anchor; otherwise the editor opens `href` in a new tab. |
67
68
  | `theme` | `{ classes?, tokens?, colorScheme? }` | Your own classes on rendered elements, colors and fonts, and light or dark. See [Theming](#theming). |
68
69
  | `toolbar` | `boolean \| { items? }` | Shows the formatting toolbar on selection, and the image toolbar on a selected image (see [Images](#images)). Default `true`. `items` lists the formatting toolbar's controls; they keep the built-in order: `textStyle`, `bold`, `italic`, `strike`, `inlineCode`, `link`, `quote`, `codeBlock`, `list` (exported as `TOOLBAR_ITEMS`). For example, `{ items: ['bold', 'italic', 'strike', 'inlineCode', 'link'] }` keeps it to inline formatting. `false` turns both toolbars off. |
@@ -127,6 +128,30 @@ function Composer() {
127
128
 
128
129
  `insertToken(text)` inserts a token such as `#tag` at the caret as a word of its own: a space before it unless the caret is at the start of the text or after whitespace, and a space after it, reusing one that is already there; the caret ends after that space. Selected text is kept, the token takes the format at the caret as typed text would (plain text in a code block), and it returns `false` without inserting while an input method is composing.
129
130
 
131
+ ### Syntax tree
132
+
133
+ A host that reads a document as data, without an editor, uses the parser directly. `parseAst(markdown, options?)` returns the CommonMark and GFM syntax tree the editor itself loads from, with the same `markdown` options and extension syntax, so a walk over the tree sees the document the editor shows. Link and image references are resolved in it (`destination` and `title` are final), escapes and entities are decoded, and `Root.definitions` keeps the link reference definitions as source text. The tree is read-only: edits go through the document (`parseMarkdown`, `serializeMarkdown`) or through the source text at the positions below.
134
+
135
+ ```ts
136
+ import { inlineNodesText, parseAst, sourceRange, visit } from '@usememos/editor';
137
+
138
+ const root = parseAst(markdown, { breaks: true });
139
+ const tasks: { checked: boolean; line: number }[] = [];
140
+ const images: string[] = [];
141
+ let excerpt = '';
142
+ visit(root, (node) => {
143
+ if (node.type === 'listItem' && node.task) tasks.push({ checked: node.checked, line: node.lines!.start });
144
+ if (node.type === 'image') images.push(node.destination);
145
+ if (node.type === 'paragraph' && !excerpt) excerpt = inlineNodesText(node.children, '\n');
146
+ });
147
+ ```
148
+
149
+ - `visit(node, visitor)` calls the visitor for every node in document order with its ancestors, root first: list items, the blocks in them, a table's cells row by row, an image's description. Returning `false` skips a node's children. `nodeChildren(node)` gives one node's children in that order.
150
+ - Every block the parser builds has `lines`, its 1-based inclusive source lines; a list item's first line holds its marker, so a task can be toggled by rewriting `[ ]` on that line. The root's `lines` has them by child index.
151
+ - Every inline node the parser builds has `pos`, a range in its block's content as the block parser built it, after quote markers and list indentation were taken off. `sourceRange(markdown, block.source, node.pos)` maps it to offsets in the Markdown; for a table cell, the block's source is `table.sources[row][cell]`. Pass `lineTable(markdown)` instead of the text for many lookups in one document.
152
+ - `inlineNodesText(nodes, soft)` is the text without markup, with `soft` for a soft line break (a space, or `"\n"` with `markdown.breaks`) and `"\n"` for a hard one, as in image alt text.
153
+ - An HTML block's `value` is its source; an image inside one is read as HTML, not from the tree. Nodes also carry `syntax`, `pieces` and the details of `source`, which source mode uses; those may change between versions.
154
+
130
155
  ### Extensions
131
156
 
132
157
  An extension is a plain object. All fields except `name` are optional.
@@ -243,7 +268,7 @@ Options: `limit` (default 8), `minLength`, the letters typed before the popup op
243
268
 
244
269
  `markdown` adds syntax; see `math()`, `footnotes()`, [docs/syntax.md](docs/syntax.md) and [docs/architecture.md](docs/architecture.md).
245
270
 
246
- `views` shows a syntax rendered instead of as source, keyed by syntax name. A key of `code:` and a language (`code:mermaid`) renders code blocks of that language, such as diagrams. The key `html` renders raw HTML: HTML blocks (`kind` `'block'`), and inline HTML (`'inline'`) one run at a time, an opening tag through its closing tag (`<kbd>**Ctrl**</kbd>`), or a single tag (`<br>`). The view gets HTML only: the editor renders the Markdown between the tags itself, inline text and the blocks inside an HTML section such as `<details>` (see [HTML blocks](docs/syntax.md#html-blocks)), and puts it in place of a marker it leaves in the HTML, so parse the source as HTML and keep its text. The editor never renders HTML itself, so sanitize it in the view. While editing, a token shows its source when the caret touches it, and a block when the selection is in it; clicking either does the same. Read-only always shows the rendered view. A view that finishes later, such as a diagram library that loads on demand, fills in a placeholder and returns a promise: the editor shows the placeholder, then the finished element; a promise that rejects or resolves to `false` shows the source. A view's element is not in the page yet, so a view that lays out text, such as a diagram, measures it with its fourth argument, the editor: `getComputedStyle(ctx.editor.root)` gives the font, for a canvas `measureText`. Rendered views are cached by source; `editor.refreshViews(syntax?)` renders them again when what they show depends on something else that changed, such as a renderer that finished loading, and the editor calls it itself when the theme's font tokens change. `math()` uses this when given a render function; the core has no math renderer of its own, so pass one such as KaTeX. A render function may return a promise, for a renderer loaded on demand; the formula's source shows until it resolves:
271
+ `views` shows a syntax rendered instead of as source, keyed by syntax name. A key of `code:` and a language (`code:mermaid`) renders code blocks of that language, such as diagrams. Raw HTML is not a view an extension provides: the editor parses it and the `sanitizeHtml` option decides what is shown (see [Raw HTML](#raw-html)), so `html` is not a key here. While editing, a token shows its source when the caret touches it, and a block when the selection is in it; clicking either does the same. Read-only always shows the rendered view. A view that finishes later, such as a diagram library that loads on demand, fills in a placeholder and returns a promise: the editor shows the placeholder, then the finished element; a promise that rejects or resolves to `false` shows the source. A view's element is not in the page yet, so a view that lays out text, such as a diagram, measures it with its fourth argument, the editor: `getComputedStyle(ctx.editor.root)` gives the font, for a canvas `measureText`. Rendered views are cached by source; `editor.refreshViews(syntax?)` renders them again when what they show depends on something else that changed, such as a renderer that finished loading, and the editor calls it itself when the theme's font tokens change. `math()` uses this when given a render function; the core has no math renderer of its own, so pass one such as KaTeX. A render function may return a promise, for a renderer loaded on demand; the formula's source shows until it resolves:
247
272
 
248
273
  ```ts
249
274
  import katex from 'katex';
@@ -365,7 +390,7 @@ new Editor({
365
390
  });
366
391
  ```
367
392
 
368
- Keys use the names of `isActive`: `paragraph`, `heading` (by level), `blockquote`, `bulletList`, `orderedList` and `taskList` (each list item; blocks are flat, so there is no list element; an item in a quote also gets the `blockquote` classes), `codeBlock`, `table`, `divider` (the `<hr>`), `raw`, `image`, `bold`, `italic`, `strike`, `code`, `link`, `token` (inline tokens of an extension syntax, by name), and `source` (source mode's highlighting, by kind of markup: `marker`, `heading`, `strong`, `em`, `strike`, `code`, `link`, `url`, `html`, `token`, `escape` and `lang`). Extensions can add classes too; the editor's own `theme` wins for the same key. `setOptions({ theme })` changes them while the editor runs.
393
+ Keys use the names of `isActive`: `paragraph`, `heading` (by level), `blockquote`, `bulletList`, `orderedList` and `taskList` (each list item; blocks are flat, so there is no list element), `codeBlock`, `table`, `divider` (the `<hr>`), `raw` (a block in a quote also gets the `blockquote` classes: it is a `blockquote` element holding the block's own element as its `.mbe-content`), `image`, `bold`, `italic`, `strike`, `code`, `link`, `token` (inline tokens of an extension syntax, by name), and `source` (source mode's highlighting, by kind of markup: `marker`, `heading`, `strong`, `em`, `strike`, `code`, `link`, `url`, `html`, `token`, `escape` and `lang`). Extensions can add classes too; the editor's own `theme` wins for the same key. `setOptions({ theme })` changes them while the editor runs.
369
394
 
370
395
  To style the editor entirely with your own classes, import `@usememos/editor/base.css` instead of `style.css`. Spacing between blocks stays in `base.css`, and its rules are more specific than a single class, so margins in your classes do not change it.
371
396
 
@@ -438,6 +463,31 @@ Make one with Collapsible section in the slash menu, Mod+Shift+6, or `>>> ` at t
438
463
 
439
464
  Only a `<details>` written the way the editor saves it loads as a section: the opening tag and a `<summary>` of plain text, a blank line, Markdown, and `</details>` at the start of a line. Other `<details>`, such as one on a single line, stay raw HTML.
440
465
 
466
+ ## Raw HTML
467
+
468
+ Markdown may hold HTML: an HTML block such as `<div align="center">` or `<!-- comment -->`, an HTML section whose tags enclose Markdown across blank lines (see [HTML blocks](docs/syntax.md#html-blocks)), and inline HTML such as `<kbd>Ctrl</kbd>`. All of it is edited as source and saved verbatim. The editor renders none of it on its own: without `sanitizeHtml`, HTML shows as its source.
469
+
470
+ `sanitizeHtml` renders it. The editor parses each HTML block and each inline run (an opening tag through its closing tag, or a single tag) with the browser's parser into a `DocumentFragment` that is not in the page, so nothing in it has run or loaded, and calls the function with the fragment and `{ kind, editor }`, where `kind` is `'block'` or `'inline'`. Return the tree to attach, after removing what your policy does not allow, or `null` to show the source instead. The function may return a promise, for a sanitizer loaded on demand: the HTML shows nothing until it settles, then the tree, and a rejection shows the source. Results are cached by source; `editor.refreshViews('html')` runs the sanitizer again.
471
+
472
+ ```ts
473
+ // A small allowlist. An app with richer HTML passes the tree to a sanitizer library and returns the result.
474
+ const ALLOWED = new Set(['details', 'summary', 'kbd', 'sup', 'sub', 'br', 'div', 'p', 'span']);
475
+ const editor = new Editor({
476
+ element,
477
+ sanitizeHtml: (tree) => {
478
+ for (const el of Array.from(tree.querySelectorAll('*'))) {
479
+ if (!ALLOWED.has(el.localName)) el.remove();
480
+ else for (const name of el.getAttributeNames()) if (name !== 'align') el.removeAttribute(name);
481
+ }
482
+ return tree;
483
+ },
484
+ });
485
+ ```
486
+
487
+ The Markdown between the tags is the editor's. The fragment holds a marker (private-use characters) in the text where it goes; keep the text, and the editor renders that Markdown itself, as blocks inside a section or inline text inside a run, with footnotes, tags, math and code highlighting as anywhere else, and puts it in place of the marker after the sanitizer has run. A sanitizer that removes the element around a marker loses nothing: that Markdown follows the rest.
488
+
489
+ The sanitizer is also the place for product policy: which hosts an `<iframe>` may load from, `target` and `rel` on links, `referrerpolicy` on images, classes. The editor keeps no such policy of its own. While editing, an HTML block shows its source when the selection is in it, and an inline run when the caret touches it; a click does the same. Read-only always shows the rendered HTML. The rendered element has the class `mbe-view-html`.
490
+
441
491
  ## Source mode
442
492
 
443
493
  With `mode: 'source'`, the editor shows the whole document as Markdown text, as Obsidian's source mode and GitLab's plain text editor do. The editor has no button or key for it: the app switches with `setOptions({ mode })` or the React `mode` prop, and remembers the choice if it wants to.
@@ -480,7 +530,7 @@ The toolbar, slash menu, block handle, block menu, link card, rendered views and
480
530
 
481
531
  Blocks you did not edit are saved exactly as they were loaded, byte for byte, including the blank lines between them. `getMarkdown()` right after loading returns the input unchanged.
482
532
 
483
- Blocks you edited, and new blocks, are written in a normalized style: `*` for italic, `**` for bold, `-` for bullets, ATX headings, fenced code, tight lists, renumbered ordered lists, and inline links instead of reference links. Soft line breaks become spaces, unless `markdown.breaks` is on. Structure the editor cannot edit as blocks (a code block or heading inside a quote, a code block or second paragraph inside a list item, lists nested more than five levels) is kept as a raw block: the original Markdown, saved verbatim. It shows rendered, and its source shows for editing when the caret is in it or it is clicked. Math and footnote blocks from the extensions are raw blocks too.
533
+ Blocks you edited, and new blocks, are written in a normalized style: `*` for italic, `**` for bold, `-` for bullets, ATX headings, fenced code, tight lists, renumbered ordered lists, and inline links instead of reference links. Soft line breaks become spaces, unless `markdown.breaks` is on. Structure the editor cannot edit as blocks (a code block or heading inside a quote, a code block or second paragraph inside a list item, lists nested more than five levels) is kept as a raw block: the original Markdown, saved verbatim. It shows rendered, and its source shows for editing when the caret is in it or it is clicked. Math and footnote blocks from the extensions are raw blocks too. A quote is saved block by block: editing one block of a quote rewrites that block (a list counts as one block), and the other blocks of the quote are saved as they were written.
484
534
 
485
535
  ## Develop
486
536
 
package/dist/base.css CHANGED
@@ -1,470 +1 @@
1
- /*
2
- * Layout the editor needs to work, and all spacing between blocks.
3
- * No colors or fonts: theme.css adds the default look. style.css imports
4
- * both; import this file alone to style the editor entirely with your own
5
- * CSS or theme classes (see the `theme` option).
6
- *
7
- * Block spacing lives here so classes added by a theme cannot change it:
8
- * these rules are more specific than a single utility class.
9
- * All selectors are scoped under .mbe-root (the editable area) and
10
- * .mbe-ui (menus, toolbar and block handle, which live in document.body).
11
- */
12
- .mbe-root,
13
- .mbe-ui {
14
- --mbe-block-gap: 8px;
15
- --mbe-indent-size: 24px;
16
- }
17
-
18
- /* Document ---------------------------------------------------------------- */
19
-
20
- .mbe-root {
21
- outline: none;
22
- white-space: pre-wrap;
23
- overflow-wrap: anywhere;
24
- caret-color: currentColor;
25
- position: relative;
26
- }
27
-
28
- /* Block rhythm: every block has the gap above and below, and adjacent
29
- margins collapse, so blocks sit one gap apart and a block with larger
30
- margins (a heading, a divider) wins. No sibling selectors: in Chrome they
31
- make every edit restyle and re-lay out all blocks after the edited one. */
32
- :is(.mbe-root, .mbe-flow) > .mbe-block {
33
- margin: var(--mbe-block-gap) 0;
34
- position: relative;
35
- /* Margins inside a block never merge with the block's own, so a block lays
36
- out the same with or without .mbe-lazy, whose containment stops them. */
37
- display: flow-root;
38
- }
39
- /* Block selection: whole blocks are highlighted and the caret is hidden.
40
- The shadow pads the highlight without moving any text. */
41
- .mbe-root.mbe-block-selecting { caret-color: transparent; }
42
- .mbe-root > .mbe-block.mbe-block-selected {
43
- background: color-mix(in srgb, Highlight 22%, transparent);
44
- box-shadow: 0 0 0 3px color-mix(in srgb, Highlight 22%, transparent);
45
- border-radius: 2px;
46
- }
47
- /* Long documents: blocks of a loaded document skip layout and paint off screen.
48
- See BlockRenderer.render for why only those. */
49
- .mbe-root > .mbe-lazy {
50
- content-visibility: auto;
51
- contain-intrinsic-size: auto 24px;
52
- }
53
-
54
- /* Headings: more room above than below. */
55
- :is(.mbe-root, .mbe-flow) > :is(h1, h2).mbe-block { margin-top: 20px; }
56
- :is(.mbe-root, .mbe-flow) > h3.mbe-block { margin-top: 20px; margin-bottom: 6px; }
57
- :is(.mbe-root, .mbe-flow) > :is(h4, h5, h6).mbe-block { margin-top: 16px; margin-bottom: 4px; }
58
-
59
- /* Quote: the renderer marks a quote block that follows another of the same
60
- quote, and one followed by another (see updateNeighborMarks). Margins are
61
- 0 between the parts of a quote and padding makes the space, so the border
62
- stays unbroken and consecutive quote blocks read as one quote. A list in a
63
- quote is a run of blockquote list items (see renderBlock): its items sit
64
- 2px apart, as outside quotes, with the gap around the list. */
65
- :is(.mbe-root, .mbe-flow) > blockquote[data-quote-continued] { margin-bottom: 0; }
66
- :is(.mbe-root, .mbe-flow) > blockquote[data-quote-joined] { margin-top: 0; padding-top: var(--mbe-block-gap); }
67
- :is(.mbe-root, .mbe-flow) > blockquote.mbe-list-item[data-quote-joined] { margin-top: 0; }
68
- :is(.mbe-root, .mbe-flow) > blockquote.mbe-list-item[data-quote-joined]:not([data-list-start]) { padding-top: 2px; }
69
-
70
- /* Callouts: a padded box with the type's icon in a start column, level with
71
- the first line. Only the first block of a callout shows the icon; the
72
- renderer marks a block followed by another of the callout with
73
- data-quote-continued, so the box pads only its first and last lines.
74
- Clicking the icon opens the type menu. */
75
- :is(.mbe-root, .mbe-flow) > blockquote[data-callout] {
76
- --mbe-callout-pad: 12px;
77
- position: relative;
78
- padding-block: var(--mbe-callout-pad);
79
- padding-inline: calc(var(--mbe-callout-pad) + 28px) 16px;
80
- }
81
- :is(.mbe-root, .mbe-flow) > blockquote[data-callout][data-quote-joined] { padding-top: var(--mbe-block-gap); }
82
- :is(.mbe-root, .mbe-flow) > blockquote[data-callout][data-quote-continued] { padding-bottom: 0; }
83
- .mbe-root .mbe-callout-icon {
84
- position: absolute;
85
- top: var(--mbe-callout-pad);
86
- inset-inline-start: calc(var(--mbe-callout-pad) - 2px);
87
- display: flex;
88
- align-items: center;
89
- justify-content: center;
90
- width: 24px;
91
- height: 1.5em;
92
- height: 1lh;
93
- user-select: none;
94
- -webkit-user-select: none;
95
- }
96
- .mbe-root .mbe-callout-icon > .mbe-icon { width: 18px; height: 18px; }
97
- :is(.mbe-root, .mbe-flow) > blockquote[data-quote-joined] > .mbe-callout-icon { display: none; }
98
- .mbe-root:not(.mbe-readonly) > blockquote > .mbe-callout-icon { cursor: pointer; }
99
-
100
- /* Collapsible sections: the title has a toggle in the indent column, and the
101
- blocks inside are indented by one step per section around them (see
102
- updateNeighborMarks). A collapsed section hides its blocks. The end of a
103
- section holds no text and takes no room. */
104
- :is(.mbe-root, .mbe-flow) > .mbe-details { display: flex; align-items: flex-start; }
105
- .mbe-root .mbe-details > .mbe-content { flex: 1; min-width: 0; position: relative; }
106
- .mbe-root .mbe-details-marker {
107
- flex: none;
108
- display: flex;
109
- align-items: center;
110
- justify-content: center;
111
- width: var(--mbe-indent-size);
112
- height: 1.5em;
113
- height: 1lh;
114
- user-select: none;
115
- -webkit-user-select: none;
116
- }
117
- .mbe-root .mbe-details-toggle {
118
- display: inline-flex;
119
- align-items: center;
120
- justify-content: center;
121
- border: 0;
122
- background: none;
123
- padding: 2px;
124
- font: inherit;
125
- color: inherit;
126
- cursor: pointer;
127
- }
128
- .mbe-root .mbe-details-toggle > .mbe-icon { transition: transform 0.12s ease; transform: rotate(90deg); }
129
- .mbe-root .mbe-details[data-collapsed] .mbe-details-toggle > .mbe-icon { transform: none; }
130
- .mbe-root .mbe-details[data-collapsed]:dir(rtl) .mbe-details-toggle > .mbe-icon { transform: scaleX(-1); }
131
- :is(.mbe-root, .mbe-flow) > .mbe-details-end.mbe-block { display: block; height: 0; margin: 0; }
132
- :is(.mbe-root, .mbe-flow) > [data-section-hidden] { display: none !important; }
133
-
134
- /* Lists: items sit close together; the list as a whole gets the block gap.
135
- The renderer marks the first item of each list with data-list-start
136
- (see updateNeighborMarks). Item margins of 2px collapse with a neighbor's
137
- gap, so only the gap shows at either end of a list. */
138
- :is(.mbe-root, .mbe-flow) > .mbe-list-item {
139
- display: flex;
140
- align-items: flex-start;
141
- margin: 2px 0;
142
- }
143
- :is(.mbe-root, .mbe-flow) > .mbe-list-item[data-list-start] { margin-top: var(--mbe-block-gap); }
144
- /* Attribute rules instead of an inline custom property, so list items share computed styles. */
145
- :is(.mbe-root, .mbe-flow) > div.mbe-list-item[data-indent='1'] { padding-inline-start: var(--mbe-indent-size); }
146
- :is(.mbe-root, .mbe-flow) > div.mbe-list-item[data-indent='2'] { padding-inline-start: calc(2 * var(--mbe-indent-size)); }
147
- :is(.mbe-root, .mbe-flow) > div.mbe-list-item[data-indent='3'] { padding-inline-start: calc(3 * var(--mbe-indent-size)); }
148
- :is(.mbe-root, .mbe-flow) > div.mbe-list-item[data-indent='4'] { padding-inline-start: calc(4 * var(--mbe-indent-size)); }
149
- :is(.mbe-root, .mbe-flow) > div.mbe-list-item[data-indent='5'] { padding-inline-start: calc(5 * var(--mbe-indent-size)); }
150
- /* In a quote the item's padding is the quote's, so the marker takes the indent. */
151
- :is(.mbe-root, .mbe-flow) > blockquote.mbe-list-item[data-indent='1'] > .mbe-marker { margin-inline-start: var(--mbe-indent-size); }
152
- :is(.mbe-root, .mbe-flow) > blockquote.mbe-list-item[data-indent='2'] > .mbe-marker { margin-inline-start: calc(2 * var(--mbe-indent-size)); }
153
- :is(.mbe-root, .mbe-flow) > blockquote.mbe-list-item[data-indent='3'] > .mbe-marker { margin-inline-start: calc(3 * var(--mbe-indent-size)); }
154
- :is(.mbe-root, .mbe-flow) > blockquote.mbe-list-item[data-indent='4'] > .mbe-marker { margin-inline-start: calc(4 * var(--mbe-indent-size)); }
155
- :is(.mbe-root, .mbe-flow) > blockquote.mbe-list-item[data-indent='5'] > .mbe-marker { margin-inline-start: calc(5 * var(--mbe-indent-size)); }
156
- .mbe-root .mbe-marker {
157
- flex: none;
158
- box-sizing: border-box;
159
- width: var(--mbe-indent-size);
160
- padding-inline-end: 6px;
161
- text-align: end;
162
- user-select: none;
163
- font-variant-numeric: tabular-nums;
164
- }
165
- .mbe-root .mbe-list-item[data-list-type='bullet'] > .mbe-marker::before { content: '•'; }
166
- .mbe-root .mbe-list-item[data-list-type='task'] > .mbe-marker { width: auto; padding-inline-end: 8px; display: flex; }
167
- .mbe-root .mbe-list-item > .mbe-content { flex: 1; min-width: 0; }
168
- .mbe-root .mbe-checkbox {
169
- box-sizing: border-box;
170
- width: 16px;
171
- height: 16px;
172
- margin: 4px 0 0;
173
- cursor: pointer;
174
- }
175
- .mbe-root.mbe-readonly .mbe-checkbox { cursor: default; }
176
- .mbe-root.mbe-readonly.mbe-tasks .mbe-checkbox { cursor: pointer; }
177
-
178
- /* Links: the text cursor while editing, so clicking places the caret. */
179
- .mbe-root a.mbe-link { cursor: text; }
180
- .mbe-root.mbe-readonly a.mbe-link { cursor: pointer; }
181
- /* Inline even under a CSS reset such as Tailwind's preflight, which makes images blocks; alignment needs it. */
182
- .mbe-root .mbe-image { display: inline-block; max-width: 100%; height: auto; margin: 8px 0; vertical-align: bottom; }
183
- /* An inline image gets room between the lines of text around it. An image
184
- alone in its block does not: the block gap already separates it, and the
185
- margin would make its block 16px taller than the image. */
186
- .mbe-root .mbe-image-block .mbe-image { margin: 0; }
187
- /* An image alone in its paragraph moves within the column; it keeps its width. */
188
- .mbe-root .mbe-image-block[data-align="left"] { text-align: left; }
189
- .mbe-root .mbe-image-block[data-align="center"] { text-align: center; }
190
- .mbe-root .mbe-image-block[data-align="right"] { text-align: right; }
191
- /* An image that did not load: an icon and its alt text, on one line. */
192
- .mbe-root .mbe-image-unavailable {
193
- display: inline-flex;
194
- align-items: center;
195
- gap: 6px;
196
- box-sizing: border-box;
197
- padding: 4px 8px;
198
- border: 1px dashed GrayText;
199
- }
200
- .mbe-root .mbe-image-alt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
201
- /* A selected image has an outline instead of the browser's selection highlight and caret.
202
- The outline is drawn inside the image, so a container that clips its overflow does not cut it. */
203
- .mbe-root .mbe-image-selected { outline: 2px solid Highlight; outline-offset: -2px; }
204
- .mbe-root.mbe-image-selection,
205
- .mbe-root.mbe-image-selection * { caret-color: transparent; }
206
- .mbe-root.mbe-image-selection ::selection { background: transparent; }
207
-
208
- /* Code */
209
- .mbe-root .mbe-code-bar { display: flex; align-items: center; }
210
- /* The copy button sits at the end of the bar and shows on hover or focus; always on touch screens. */
211
- .mbe-root .mbe-code-copy {
212
- margin-inline-start: auto;
213
- display: inline-flex;
214
- align-items: center;
215
- justify-content: center;
216
- border: 0;
217
- background: none;
218
- padding: 2px;
219
- font: inherit;
220
- color: inherit;
221
- cursor: pointer;
222
- opacity: 0;
223
- }
224
- /* The icon matches the language label's 12px text, so the button is as tall as the label's line. */
225
- .mbe-root .mbe-code-copy .mbe-icon { width: 12px; height: 12px; }
226
- .mbe-root .mbe-code:hover .mbe-code-copy,
227
- .mbe-root .mbe-code-copy:focus-visible,
228
- .mbe-root .mbe-code-copy.mbe-copied { opacity: 1; }
229
- @media (hover: none) {
230
- .mbe-root .mbe-code-copy { opacity: 1; }
231
- }
232
- .mbe-root .mbe-code-lang {
233
- font: inherit;
234
- color: inherit;
235
- background: transparent;
236
- border: none;
237
- outline: none;
238
- padding: 0;
239
- width: 12em;
240
- }
241
- /* Code keeps its lines and scrolls sideways, as GitHub shows it; raw source wraps. */
242
- :is(.mbe-root, .mbe-flow) > .mbe-code pre { white-space: pre; overflow-x: auto; tab-size: 2; }
243
- :is(.mbe-root, .mbe-flow) > pre.mbe-raw { white-space: pre-wrap; tab-size: 2; }
244
- /* Source mode: the document as plain text; theme.css sets its mono font. */
245
- .mbe-root > .mbe-source { white-space: pre-wrap; tab-size: 4; overflow-wrap: anywhere; }
246
- /* One block per line, so a keystroke lays out only its line. */
247
- .mbe-root > .mbe-source .mbe-source-line { display: block; }
248
- :is(.mbe-root, .mbe-flow) > .mbe-code pre { margin: 0; }
249
- :is(.mbe-root, .mbe-flow) > .mbe-code pre code { display: block; }
250
-
251
- /* Rendered views (see Extension.views): a token or raw block shown rendered,
252
- such as math. Clicking one, or moving the caret onto it, shows its source. */
253
- :is(.mbe-root, .mbe-flow) > .mbe-view-block { overflow-x: auto; overflow-y: hidden; }
254
- /* A renderer's own block margins (KaTeX's display math has 1em) would add to the block gap. */
255
- :is(.mbe-root, .mbe-flow) > .mbe-view-block > * { margin-block: 0; }
256
- /* A block an extension's block view draws (see Extension.blockView): the app owns what is inside, so nothing is clipped. */
257
- .mbe-root > .mbe-block-view { overflow: visible; }
258
- /* A block view placed after its block, which stays editable text: not text itself, like a widget. */
259
- .mbe-root > .mbe-block-after { cursor: default; white-space: normal; }
260
- /* A footnote definition: its label in a column beside the text, which may be
261
- several blocks; the label sits on the first line's baseline. */
262
- :is(.mbe-root, .mbe-flow, .mbe-footnotes) > .mbe-footnote { display: grid; grid-template-columns: auto 1fr; column-gap: 0.375em; align-items: baseline; }
263
- :is(.mbe-root, .mbe-flow, .mbe-footnotes) > .mbe-footnote > :last-child { min-width: 0; }
264
- /* Footnotes, read-only: the definitions hide where they are written and the
265
- referenced ones are collected in a section at the end (see footnotes()). */
266
- .mbe-root > .mbe-footnote-collected { display: none; }
267
- .mbe-root > .mbe-footnotes { margin-top: 16px; cursor: default; }
268
- .mbe-root > .mbe-footnotes > .mbe-footnote + .mbe-footnote { margin-top: 4px; }
269
- .mbe-root .mbe-footnote-backref { display: inline-flex; align-items: center; vertical-align: -0.125em; }
270
- .mbe-root .mbe-footnote-backref .mbe-icon { width: 0.875em; height: 0.875em; }
271
- /* Tags and mentions with an onClick, read-only: clickable, as links are. */
272
- .mbe-root.mbe-readonly :is([data-mbe-tag], [data-mbe-mention]) { cursor: pointer; }
273
- /* Rendered HTML: line breaks between its tags are not text. The Markdown
274
- between the tags of an HTML section (.mbe-flow) is blocks again, one
275
- block gap from the HTML around it. */
276
- .mbe-root .mbe-view-block.mbe-view-html { white-space: normal; }
277
- .mbe-root .mbe-view-html .mbe-flow { white-space: pre-wrap; margin-block: var(--mbe-block-gap); }
278
- .mbe-root .mbe-view-html :is(p, blockquote, pre, ul, ol, dl, table, details, figure, hr, h1, h2, h3, h4, h5, h6):not(.mbe-flow *) { margin-block: var(--mbe-block-gap); }
279
- .mbe-root .mbe-view-html :is(ul, ol):not(.mbe-flow *) { padding-inline-start: var(--mbe-indent-size); }
280
- .mbe-root .mbe-view-html ul:not(.mbe-flow *) { list-style: disc; }
281
- .mbe-root .mbe-view-html ol:not(.mbe-flow *) { list-style: decimal; }
282
- .mbe-root .mbe-view-html pre:not(.mbe-flow *) { white-space: pre; overflow-x: auto; }
283
- .mbe-root .mbe-view-html summary:not(.mbe-flow *) { cursor: pointer; }
284
- .mbe-root .mbe-view-html img:not(.mbe-flow *) { max-width: 100%; }
285
- /* Nothing above the first element or below the last, as for blocks. */
286
- .mbe-root .mbe-view-html :is(details, blockquote, li, td, th, div, section):not(.mbe-flow *) > :first-child,
287
- .mbe-root .mbe-view-block.mbe-view-html > :first-child { margin-top: 0; }
288
- .mbe-root .mbe-view-html :is(details, blockquote, li, td, th, div, section):not(.mbe-flow *) > :last-child,
289
- .mbe-root .mbe-view-block.mbe-view-html > :last-child { margin-bottom: 0; }
290
-
291
- /* Divider: the padding gives the line a larger click target. */
292
- :is(.mbe-root, .mbe-flow) > .mbe-divider.mbe-block { margin: 16px 0; padding: 4px 0; cursor: default; }
293
- :is(.mbe-root, .mbe-flow) > .mbe-divider hr { margin: 0; }
294
-
295
- /* Table */
296
- :is(.mbe-root, .mbe-flow) > .mbe-table { overflow-x: auto; }
297
- /* The table fills the editor's width and its columns share it by their
298
- content, as claude.ai lays tables out; one whose longest words do not
299
- fit scrolls. Cells wrap at words: the root's overflow-wrap: anywhere
300
- would let the layout shrink any column to one character and break words
301
- to make the table fit, break-word keeps every column as wide as its
302
- longest word. */
303
- :is(.mbe-root, .mbe-flow) > .mbe-table table { width: 100%; border-collapse: separate; border-spacing: 0; }
304
- :is(.mbe-root, .mbe-flow) > .mbe-table th,
305
- :is(.mbe-root, .mbe-flow) > .mbe-table td {
306
- padding: 0.4375em 0.75em;
307
- vertical-align: top;
308
- text-align: start;
309
- overflow-wrap: break-word;
310
- outline: none;
311
- }
312
- /* An empty cell keeps room to click into while editing. */
313
- .mbe-root:not(.mbe-readonly) > .mbe-table :is(th, td).mbe-empty-content { min-width: 4em; }
314
-
315
- /* Blocks inside collapsible sections, after the block rules so it wins over their margins. */
316
- :is(.mbe-root, .mbe-flow) > [data-in-section] { margin-inline-start: calc(var(--mbe-section-depth, 0) * var(--mbe-indent-size)); }
317
-
318
- /* Nothing above the first block or below the last, whatever their type. */
319
- :is(.mbe-root, .mbe-flow) > .mbe-block:first-child { margin-top: 0; }
320
- :is(.mbe-root, .mbe-flow) > .mbe-block:last-child { margin-bottom: 0; }
321
-
322
- /* Placeholders and hints. When both apply, the slash hint wins over the placeholder.
323
- Hints for empty headings, list items and quotes are for writing, so read-only hides them. */
324
- .mbe-root .mbe-empty-content { position: relative; }
325
- .mbe-root > .mbe-paragraph.mbe-empty:only-child::before,
326
- .mbe-root > .mbe-paragraph.mbe-empty.mbe-show-hint::before,
327
- .mbe-root:not(.mbe-readonly) > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote:not(.mbe-list-item))::before,
328
- .mbe-root:not(.mbe-readonly) > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before,
329
- .mbe-root:not(.mbe-readonly) > .mbe-details.mbe-empty[data-hint] > .mbe-content::before,
330
- .mbe-root > .mbe-source.mbe-empty:only-child > .mbe-source-text::before {
331
- opacity: 0.5;
332
- pointer-events: none;
333
- position: absolute;
334
- }
335
- .mbe-root > .mbe-paragraph.mbe-empty:only-child::before,
336
- .mbe-root > .mbe-source.mbe-empty:only-child > .mbe-source-text::before { content: var(--mbe-placeholder, ''); }
337
- .mbe-root > .mbe-paragraph.mbe-empty.mbe-show-hint::before { content: var(--mbe-slash-hint, ''); }
338
- .mbe-root:not(.mbe-readonly) > .mbe-empty[data-hint]:is(h1, h2, h3, h4, h5, h6, blockquote:not(.mbe-list-item))::before,
339
- .mbe-root:not(.mbe-readonly) > .mbe-list-item.mbe-empty[data-hint] > .mbe-content::before,
340
- .mbe-root:not(.mbe-readonly) > .mbe-details.mbe-empty[data-hint] > .mbe-content::before { content: attr(data-hint); }
341
-
342
- /* Widgets: app UI between blocks, such as an upload placeholder. Not editable text. */
343
- .mbe-root > .mbe-widget { cursor: default; user-select: none; -webkit-user-select: none; white-space: normal; }
344
-
345
- /* Floating UI -------------------------------------------------------------
346
- System colors keep menus readable when theme.css is not loaded. */
347
-
348
- .mbe-ui { z-index: var(--mbe-popup-z, 1000); }
349
- .mbe-icon { display: block; flex: none; width: 16px; height: 16px; }
350
- .mbe-ui[hidden] { display: none !important; }
351
- .mbe-menu,
352
- .mbe-toolbar,
353
- .mbe-image-toolbar,
354
- .mbe-link-card,
355
- .mbe-input-popover {
356
- position: fixed;
357
- background: Canvas;
358
- color: CanvasText;
359
- border: 1px solid GrayText;
360
- }
361
- .mbe-menu { min-width: 200px; max-height: 320px; overflow-y: auto; padding: 4px; }
362
- .mbe-menu-title { padding: 6px 8px 4px; }
363
- .mbe-menu-item { display: flex; align-items: center; gap: 8px; padding: 4px 8px; cursor: pointer; user-select: none; }
364
- .mbe-menu-item.mbe-highlighted { background: Highlight; color: HighlightText; }
365
- .mbe-menu-icon {
366
- flex: none;
367
- width: 22px;
368
- height: 22px;
369
- display: inline-flex;
370
- align-items: center;
371
- justify-content: center;
372
- }
373
- .mbe-menu-icon:empty { display: none; }
374
- .mbe-menu-label { flex: 1; }
375
- .mbe-suggestion-menu { max-width: 360px; }
376
- /* Emoji from @usememos/editor/emoji are their items' icons. */
377
- .mbe-emoji-menu .mbe-menu-icon { font-size: 18px; line-height: 1; }
378
- .mbe-suggestion-menu .mbe-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
379
- .mbe-menu-detail { flex: none; white-space: nowrap; }
380
- .mbe-menu-match { background: none; color: inherit; font-weight: 600; }
381
- .mbe-menu-empty,
382
- .mbe-menu-loading { padding: 6px 8px; }
383
-
384
- /* Wider than the screen, the toolbar scrolls sideways; its max-width is set to fit. */
385
- .mbe-toolbar,
386
- .mbe-image-toolbar { box-sizing: border-box; display: flex; align-items: center; gap: 2px; padding: 4px; overflow-x: auto; scrollbar-width: none; }
387
- .mbe-toolbar::-webkit-scrollbar,
388
- .mbe-image-toolbar::-webkit-scrollbar { display: none; }
389
- /* A tool is a 28px control with a 16px icon, so a bar is 36px tall with its
390
- 4px padding: compact next to the 24px lines it floats over, and the size
391
- of a host app's own controls. */
392
- .mbe-tool {
393
- flex: none;
394
- font: inherit;
395
- color: inherit;
396
- background: none;
397
- border: none;
398
- padding: 2px 6px;
399
- min-width: 28px;
400
- min-height: 28px;
401
- display: inline-flex;
402
- align-items: center;
403
- justify-content: center;
404
- cursor: pointer;
405
- }
406
- .mbe-tool[hidden],
407
- .mbe-tool-sep[hidden] { display: none; }
408
- .mbe-tool .mbe-icon { width: 16px; height: 16px; }
409
- .mbe-tool-menu { gap: 1px; padding-inline: 6px 3px; }
410
- .mbe-tool-icon,
411
- .mbe-tool-chevron { display: inline-flex; }
412
- .mbe-tool .mbe-tool-chevron .mbe-icon { width: 12px; height: 12px; }
413
- .mbe-tool.mbe-active { background: Highlight; color: HighlightText; }
414
- .mbe-tool-sep { flex: none; width: 1px; height: 16px; margin: 0 2px; background: GrayText; }
415
- .mbe-menu-check { flex: none; display: inline-flex; margin-inline-start: auto; }
416
- .mbe-menu-submenu { flex: none; display: inline-flex; margin-inline-start: auto; }
417
- .mbe-menu-submenu .mbe-icon { width: 14px; height: 14px; }
418
- .mbe-submenu { min-width: 160px; }
419
- /* The row whose submenu is open stays marked while the pointer is in the submenu. */
420
- .mbe-menu-item[aria-expanded="true"] { background: Highlight; color: HighlightText; }
421
-
422
- .mbe-tooltip { position: fixed; pointer-events: none; white-space: nowrap; padding: 4px 8px; background: CanvasText; color: Canvas; }
423
-
424
- .mbe-input-popover { display: flex; gap: 4px; padding: 4px; }
425
-
426
- .mbe-link-card { box-sizing: border-box; display: flex; align-items: center; gap: 2px; padding: 4px; max-width: min(420px, calc(100vw - 16px)); }
427
- .mbe-link-card-url { flex: 0 1 auto; min-width: 0; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: LinkText; }
428
- .mbe-tool:disabled { opacity: 0.4; cursor: default; }
429
-
430
- /* The resize handles of an image: a frame over it that only its resize handles respond to. */
431
- .mbe-image-frame { position: fixed; pointer-events: none; }
432
- .mbe-resize-handle {
433
- position: absolute;
434
- top: 50%;
435
- width: 6px;
436
- height: 40%;
437
- min-height: 16px;
438
- max-height: 48px;
439
- box-sizing: border-box;
440
- transform: translate(-50%, -50%);
441
- pointer-events: auto;
442
- touch-action: none;
443
- cursor: ew-resize;
444
- background: Canvas;
445
- border: 1px solid CanvasText;
446
- border-radius: 3px;
447
- }
448
- /* A larger area to grab than the resize handle shows. */
449
- .mbe-resize-handle::before { content: ''; position: absolute; inset: -6px -8px; }
450
- .mbe-resize-handle-left { left: 8px; }
451
- .mbe-resize-handle-right { left: calc(100% - 8px); }
452
- .mbe-image-frame-small .mbe-resize-handle-left { left: 0; }
453
- .mbe-image-frame-small .mbe-resize-handle-right { left: 100%; }
454
- .mbe-image-resizing,
455
- .mbe-image-resizing .mbe-resize-handle { cursor: ew-resize; }
456
- .mbe-popover-input { font: inherit; color: inherit; box-sizing: border-box; height: 28px; width: 260px; padding: 0 8px; }
457
-
458
- .mbe-block-handle {
459
- position: fixed;
460
- width: 20px;
461
- height: 22px;
462
- padding: 0;
463
- border: none;
464
- background: none;
465
- color: inherit;
466
- display: flex;
467
- align-items: center;
468
- justify-content: center;
469
- cursor: pointer;
470
- }
1
+ .mbe-root,.mbe-ui{--mbe-block-gap: 8px;--mbe-indent-size: 24px}.mbe-root{outline:none;white-space:pre-wrap;overflow-wrap:anywhere;caret-color:currentColor;position:relative}:is(.mbe-root,.mbe-flow)>.mbe-block{margin:var(--mbe-block-gap) 0;position:relative;display:flow-root}.mbe-root.mbe-block-selecting{caret-color:transparent}.mbe-root>.mbe-block.mbe-block-selected{background:color-mix(in srgb,Highlight 22%,transparent);box-shadow:0 0 0 3px color-mix(in srgb,Highlight 22%,transparent);border-radius:2px}.mbe-root>.mbe-lazy{content-visibility:auto;contain-intrinsic-size:auto 24px}:is(.mbe-root,.mbe-flow)>:is(h1,h2).mbe-block{margin-top:20px}:is(.mbe-root,.mbe-flow)>h3.mbe-block{margin-top:20px;margin-bottom:6px}:is(.mbe-root,.mbe-flow)>:is(h4,h5,h6).mbe-block{margin-top:16px;margin-bottom:4px}:is(.mbe-root,.mbe-flow)>blockquote[data-quote-continued]{margin-bottom:0}:is(.mbe-root,.mbe-flow)>blockquote[data-quote-joined]{margin-top:0;padding-top:var(--mbe-block-gap)}:is(.mbe-root,.mbe-flow)>blockquote.mbe-list-item[data-quote-joined]{margin-top:0}:is(.mbe-root,.mbe-flow)>blockquote.mbe-list-item[data-quote-joined]:not([data-list-start]){padding-top:2px}:is(.mbe-root,.mbe-flow)>blockquote>.mbe-content{margin:0}:is(.mbe-root,.mbe-flow)>blockquote[data-callout]{--mbe-callout-pad: 12px;position:relative;padding-block:var(--mbe-callout-pad);padding-inline:calc(var(--mbe-callout-pad) + 28px) 16px}:is(.mbe-root,.mbe-flow)>blockquote[data-callout][data-quote-joined]{padding-top:var(--mbe-block-gap)}:is(.mbe-root,.mbe-flow)>blockquote[data-callout][data-quote-continued]{padding-bottom:0}.mbe-root .mbe-callout-icon{position:absolute;top:var(--mbe-callout-pad);inset-inline-start:calc(var(--mbe-callout-pad) - 2px);display:flex;align-items:center;justify-content:center;width:24px;height:1.5em;height:1lh;user-select:none;-webkit-user-select:none}.mbe-root .mbe-callout-icon>.mbe-icon{width:18px;height:18px}:is(.mbe-root,.mbe-flow)>blockquote[data-quote-joined]>.mbe-callout-icon{display:none}.mbe-root:not(.mbe-readonly)>blockquote>.mbe-callout-icon{cursor:pointer}:is(.mbe-root,.mbe-flow)>.mbe-details{display:flex;align-items:flex-start}.mbe-root .mbe-details>.mbe-content{flex:1;min-width:0;position:relative}.mbe-root .mbe-details-marker{flex:none;display:flex;align-items:center;justify-content:center;width:var(--mbe-indent-size);height:1.5em;height:1lh;user-select:none;-webkit-user-select:none}.mbe-root .mbe-details-toggle{display:inline-flex;align-items:center;justify-content:center;border:0;background:none;padding:2px;font:inherit;color:inherit;cursor:pointer}.mbe-root .mbe-details-toggle>.mbe-icon{transition:transform .12s ease;transform:rotate(90deg)}.mbe-root .mbe-details[data-collapsed] .mbe-details-toggle>.mbe-icon{transform:none}.mbe-root .mbe-details[data-collapsed]:dir(rtl) .mbe-details-toggle>.mbe-icon{transform:scaleX(-1)}:is(.mbe-root,.mbe-flow)>.mbe-details-end.mbe-block{display:block;height:0;margin:0}:is(.mbe-root,.mbe-flow)>[data-section-hidden]{display:none!important}:is(.mbe-root,.mbe-flow)>.mbe-list-item{display:flex;align-items:flex-start;margin:2px 0}:is(.mbe-root,.mbe-flow)>.mbe-list-item[data-list-start]{margin-top:var(--mbe-block-gap)}:is(.mbe-root,.mbe-flow)>div.mbe-list-item[data-indent="1"]{padding-inline-start:var(--mbe-indent-size)}:is(.mbe-root,.mbe-flow)>div.mbe-list-item[data-indent="2"]{padding-inline-start:calc(2 * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>div.mbe-list-item[data-indent="3"]{padding-inline-start:calc(3 * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>div.mbe-list-item[data-indent="4"]{padding-inline-start:calc(4 * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>div.mbe-list-item[data-indent="5"]{padding-inline-start:calc(5 * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>blockquote.mbe-list-item[data-indent="1"]>.mbe-marker{margin-inline-start:var(--mbe-indent-size)}:is(.mbe-root,.mbe-flow)>blockquote.mbe-list-item[data-indent="2"]>.mbe-marker{margin-inline-start:calc(2 * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>blockquote.mbe-list-item[data-indent="3"]>.mbe-marker{margin-inline-start:calc(3 * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>blockquote.mbe-list-item[data-indent="4"]>.mbe-marker{margin-inline-start:calc(4 * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>blockquote.mbe-list-item[data-indent="5"]>.mbe-marker{margin-inline-start:calc(5 * var(--mbe-indent-size))}.mbe-root .mbe-marker{flex:none;box-sizing:border-box;width:var(--mbe-indent-size);padding-inline-end:6px;text-align:end;user-select:none;font-variant-numeric:tabular-nums}.mbe-root .mbe-list-item[data-list-type=bullet]>.mbe-marker:before{content:"\2022"}.mbe-root .mbe-list-item[data-list-type=task]>.mbe-marker{width:auto;padding-inline-end:8px;display:flex}.mbe-root .mbe-list-item>.mbe-content{flex:1;min-width:0}.mbe-root .mbe-checkbox{box-sizing:border-box;width:16px;height:16px;margin:4px 0 0;cursor:pointer}.mbe-root.mbe-readonly .mbe-checkbox{cursor:default}.mbe-root.mbe-readonly.mbe-tasks .mbe-checkbox{cursor:pointer}.mbe-root a.mbe-link{cursor:text}.mbe-root.mbe-readonly a.mbe-link{cursor:pointer}.mbe-root .mbe-image{display:inline-block;max-width:100%;height:auto;margin:8px 0;vertical-align:bottom}.mbe-root .mbe-image-block .mbe-image{margin:0}.mbe-root .mbe-image-block[data-align=left]{text-align:left}.mbe-root .mbe-image-block[data-align=center]{text-align:center}.mbe-root .mbe-image-block[data-align=right]{text-align:right}.mbe-root .mbe-image-unavailable{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;padding:4px 8px;border:1px dashed GrayText}.mbe-root .mbe-image-alt{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mbe-root .mbe-image-selected{outline:2px solid Highlight;outline-offset:-2px}.mbe-root.mbe-image-selection,.mbe-root.mbe-image-selection *{caret-color:transparent}.mbe-root.mbe-image-selection ::selection{background:transparent}.mbe-root .mbe-code-bar{display:flex;align-items:center}.mbe-root .mbe-code-copy{margin-inline-start:auto;display:inline-flex;align-items:center;justify-content:center;border:0;background:none;padding:2px;font:inherit;color:inherit;cursor:pointer;opacity:0}.mbe-root .mbe-code-copy .mbe-icon{width:12px;height:12px}.mbe-root .mbe-code:hover .mbe-code-copy,.mbe-root .mbe-code-copy:focus-visible,.mbe-root .mbe-code-copy.mbe-copied{opacity:1}@media(hover:none){.mbe-root .mbe-code-copy{opacity:1}}.mbe-root .mbe-code-lang{font:inherit;color:inherit;background:transparent;border:none;outline:none;padding:0;width:12em}:is(.mbe-root,.mbe-flow)>.mbe-code pre{white-space:pre;overflow-x:auto;tab-size:2}:is(.mbe-root,.mbe-flow)>pre.mbe-raw,:is(.mbe-root,.mbe-flow)>blockquote.mbe-raw>pre{white-space:pre-wrap;tab-size:2}.mbe-root>.mbe-source{white-space:pre-wrap;tab-size:4;overflow-wrap:anywhere}.mbe-root>.mbe-source .mbe-source-line{display:block}:is(.mbe-root,.mbe-flow)>.mbe-code pre{margin:0}:is(.mbe-root,.mbe-flow)>.mbe-code pre code{display:block}:is(.mbe-root,.mbe-flow)>.mbe-view-block{overflow-x:auto;overflow-y:hidden}:is(.mbe-root,.mbe-flow)>.mbe-view-block>*{margin-block:0}.mbe-root>.mbe-block-view{overflow:visible}.mbe-root>.mbe-block-after{cursor:default;white-space:normal}:is(.mbe-root,.mbe-flow,.mbe-footnotes)>.mbe-footnote{display:grid;grid-template-columns:auto 1fr;column-gap:.375em;align-items:baseline}:is(.mbe-root,.mbe-flow,.mbe-footnotes)>.mbe-footnote>:last-child{min-width:0}.mbe-root>.mbe-footnote-collected{display:none}.mbe-root>.mbe-footnotes{margin-top:16px;cursor:default}.mbe-root>.mbe-footnotes>.mbe-footnote+.mbe-footnote{margin-top:4px}.mbe-root .mbe-footnote-backref{display:inline-flex;align-items:center;vertical-align:-.125em}.mbe-root .mbe-footnote-backref .mbe-icon{width:.875em;height:.875em}.mbe-root.mbe-readonly :is([data-mbe-tag],[data-mbe-mention]){cursor:pointer}.mbe-root .mbe-view-block.mbe-view-html{white-space:normal}.mbe-root .mbe-view-html .mbe-flow{white-space:pre-wrap;margin-block:var(--mbe-block-gap)}.mbe-root .mbe-view-html :is(p,blockquote,pre,ul,ol,dl,table,details,figure,hr,h1,h2,h3,h4,h5,h6):not(.mbe-flow *){margin-block:var(--mbe-block-gap)}.mbe-root .mbe-view-html :is(ul,ol):not(.mbe-flow *){padding-inline-start:var(--mbe-indent-size)}.mbe-root .mbe-view-html ul:not(.mbe-flow *){list-style:disc}.mbe-root .mbe-view-html ol:not(.mbe-flow *){list-style:decimal}.mbe-root .mbe-view-html pre:not(.mbe-flow *){white-space:pre;overflow-x:auto}.mbe-root .mbe-view-html summary:not(.mbe-flow *){cursor:pointer}.mbe-root .mbe-view-html img:not(.mbe-flow *){max-width:100%}.mbe-root .mbe-view-html :is(details,blockquote,li,td,th,div,section):not(.mbe-flow *)>:first-child,.mbe-root .mbe-view-block.mbe-view-html>:first-child{margin-top:0}.mbe-root .mbe-view-html :is(details,blockquote,li,td,th,div,section):not(.mbe-flow *)>:last-child,.mbe-root .mbe-view-block.mbe-view-html>:last-child{margin-bottom:0}:is(.mbe-root,.mbe-flow)>.mbe-divider.mbe-block:not(blockquote){margin:16px 0;padding:4px 0;cursor:default}:is(.mbe-root,.mbe-flow)>blockquote.mbe-divider>.mbe-content{padding:4px 0;cursor:default}:is(.mbe-root,.mbe-flow)>.mbe-divider hr{margin:0}:is(.mbe-root,.mbe-flow)>.mbe-table{overflow-x:auto}:is(.mbe-root,.mbe-flow)>.mbe-table table{width:100%;border-collapse:separate;border-spacing:0}:is(.mbe-root,.mbe-flow)>.mbe-table th,:is(.mbe-root,.mbe-flow)>.mbe-table td{padding:.4375em .75em;vertical-align:top;text-align:start;overflow-wrap:break-word;outline:none}.mbe-root:not(.mbe-readonly)>.mbe-table :is(th,td).mbe-empty-content{min-width:4em}:is(.mbe-root,.mbe-flow)>[data-in-section]{margin-inline-start:calc(var(--mbe-section-depth, 0) * var(--mbe-indent-size))}:is(.mbe-root,.mbe-flow)>.mbe-block:first-child{margin-top:0}:is(.mbe-root,.mbe-flow)>.mbe-block:last-child{margin-bottom:0}.mbe-root .mbe-empty-content{position:relative}.mbe-root>.mbe-paragraph.mbe-empty:only-child:before,.mbe-root>.mbe-paragraph.mbe-empty.mbe-show-hint:before,.mbe-root:not(.mbe-readonly)>.mbe-empty[data-hint]:is(h1,h2,h3,h4,h5,h6,blockquote.mbe-quote):before,.mbe-root:not(.mbe-readonly)>:is(.mbe-list-item,.mbe-heading,.mbe-details).mbe-empty[data-hint]>.mbe-content:before,.mbe-root>.mbe-source.mbe-empty:only-child>.mbe-source-text:before{opacity:.5;pointer-events:none;position:absolute}.mbe-root>.mbe-paragraph.mbe-empty:only-child:before,.mbe-root>.mbe-source.mbe-empty:only-child>.mbe-source-text:before{content:var(--mbe-placeholder, "")}.mbe-root>.mbe-paragraph.mbe-empty.mbe-show-hint:before{content:var(--mbe-slash-hint, "")}.mbe-root:not(.mbe-readonly)>.mbe-empty[data-hint]:is(h1,h2,h3,h4,h5,h6,blockquote.mbe-quote):before,.mbe-root:not(.mbe-readonly)>:is(.mbe-list-item,.mbe-heading,.mbe-details).mbe-empty[data-hint]>.mbe-content:before{content:attr(data-hint)}.mbe-root>.mbe-widget{cursor:default;user-select:none;-webkit-user-select:none;white-space:normal}.mbe-ui{z-index:var(--mbe-popup-z, 1000)}.mbe-icon{display:block;flex:none;width:16px;height:16px}.mbe-ui[hidden]{display:none!important}.mbe-menu,.mbe-toolbar,.mbe-image-toolbar,.mbe-link-card,.mbe-input-popover{position:fixed;background:Canvas;color:CanvasText;border:1px solid GrayText}.mbe-menu{min-width:200px;max-height:320px;overflow-y:auto;padding:4px}.mbe-menu-title{padding:6px 8px 4px}.mbe-menu-item{display:flex;align-items:center;gap:8px;padding:4px 8px;cursor:pointer;user-select:none}.mbe-menu-item.mbe-highlighted{background:Highlight;color:HighlightText}.mbe-menu-icon{flex:none;width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center}.mbe-menu-icon:empty{display:none}.mbe-menu-label{flex:1}.mbe-suggestion-menu{max-width:360px}.mbe-emoji-menu .mbe-menu-icon{font-size:18px;line-height:1}.mbe-suggestion-menu .mbe-menu-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mbe-menu-detail{flex:none;white-space:nowrap}.mbe-menu-match{background:none;color:inherit;font-weight:600}.mbe-menu-empty,.mbe-menu-loading{padding:6px 8px}.mbe-toolbar,.mbe-image-toolbar{box-sizing:border-box;display:flex;align-items:center;gap:2px;padding:4px;overflow-x:auto;scrollbar-width:none}.mbe-toolbar::-webkit-scrollbar,.mbe-image-toolbar::-webkit-scrollbar{display:none}.mbe-tool{flex:none;font:inherit;color:inherit;background:none;border:none;padding:2px 6px;min-width:28px;min-height:28px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.mbe-tool[hidden],.mbe-tool-sep[hidden]{display:none}.mbe-tool .mbe-icon{width:16px;height:16px}.mbe-tool-menu{gap:1px;padding-inline:6px 3px}.mbe-tool-icon,.mbe-tool-chevron{display:inline-flex}.mbe-tool .mbe-tool-chevron .mbe-icon{width:12px;height:12px}.mbe-tool.mbe-active{background:Highlight;color:HighlightText}.mbe-tool-sep{flex:none;width:1px;height:16px;margin:0 2px;background:GrayText}.mbe-menu-check,.mbe-menu-submenu{flex:none;display:inline-flex;margin-inline-start:auto}.mbe-menu-submenu .mbe-icon{width:14px;height:14px}.mbe-submenu{min-width:160px}.mbe-menu-item[aria-expanded=true]{background:Highlight;color:HighlightText}.mbe-tooltip{position:fixed;pointer-events:none;white-space:nowrap;padding:4px 8px;background:CanvasText;color:Canvas}.mbe-input-popover{display:flex;gap:4px;padding:4px}.mbe-link-card{box-sizing:border-box;display:flex;align-items:center;gap:2px;padding:4px;max-width:min(420px,calc(100vw - 16px))}.mbe-link-card-url{flex:0 1 auto;min-width:0;padding:0 6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:LinkText}.mbe-tool:disabled{opacity:.4;cursor:default}.mbe-image-frame{position:fixed;pointer-events:none}.mbe-resize-handle{position:absolute;top:50%;width:6px;height:40%;min-height:16px;max-height:48px;box-sizing:border-box;transform:translate(-50%,-50%);pointer-events:auto;touch-action:none;cursor:ew-resize;background:Canvas;border:1px solid CanvasText;border-radius:3px}.mbe-resize-handle:before{content:"";position:absolute;inset:-6px -8px}.mbe-resize-handle-left{left:8px}.mbe-resize-handle-right{left:calc(100% - 8px)}.mbe-image-frame-small .mbe-resize-handle-left{left:0}.mbe-image-frame-small .mbe-resize-handle-right{left:100%}.mbe-image-resizing,.mbe-image-resizing .mbe-resize-handle{cursor:ew-resize}.mbe-popover-input{font:inherit;color:inherit;box-sizing:border-box;height:28px;width:260px;padding:0 8px}.mbe-block-handle{position:fixed;width:20px;height:22px;padding:0;border:none;background:none;color:inherit;display:flex;align-items:center;justify-content:center;cursor:pointer}