@futaba-soft/mbox 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/create-editor-BKTpQ8TK.js +2866 -0
- package/dist/editor/create-editor.d.ts +100 -0
- package/dist/editor/document-cache.d.ts +20 -0
- package/dist/editor/focused-line.d.ts +14 -0
- package/dist/editor/plugin.d.ts +191 -0
- package/dist/editor/test-context.d.ts +28 -0
- package/dist/gfm.d.ts +34 -0
- package/dist/gfm.js +1719 -0
- package/dist/hatena.d.ts +32 -0
- package/dist/hatena.js +856 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +77 -0
- package/dist/plugin-DI0ubB-M.js +297 -0
- package/dist/plugins/bracket-pair-kit.d.ts +9 -0
- package/dist/plugins/code-block-kit.d.ts +77 -0
- package/dist/plugins/code-block-language-loader.d.ts +33 -0
- package/dist/plugins/gfm/active-lines.d.ts +11 -0
- package/dist/plugins/gfm/code-block.d.ts +28 -0
- package/dist/plugins/gfm/footnote.d.ts +17 -0
- package/dist/plugins/gfm/heading.d.ts +12 -0
- package/dist/plugins/gfm/image.d.ts +30 -0
- package/dist/plugins/gfm/index.d.ts +19 -0
- package/dist/plugins/gfm/inline-code.d.ts +4 -0
- package/dist/plugins/gfm/inline.d.ts +4 -0
- package/dist/plugins/gfm/link.d.ts +34 -0
- package/dist/plugins/gfm/list.d.ts +32 -0
- package/dist/plugins/gfm/math.d.ts +39 -0
- package/dist/plugins/gfm/parser-cache.d.ts +3 -0
- package/dist/plugins/gfm/parser.d.ts +355 -0
- package/dist/plugins/gfm/quote.d.ts +3 -0
- package/dist/plugins/gfm/table.d.ts +34 -0
- package/dist/plugins/gfm/thematic-break.d.ts +9 -0
- package/dist/plugins/hatena/blockquote.d.ts +12 -0
- package/dist/plugins/hatena/definition.d.ts +5 -0
- package/dist/plugins/hatena/footnote.d.ts +15 -0
- package/dist/plugins/hatena/heading.d.ts +8 -0
- package/dist/plugins/hatena/index.d.ts +12 -0
- package/dist/plugins/hatena/link.d.ts +16 -0
- package/dist/plugins/hatena/list.d.ts +24 -0
- package/dist/plugins/hatena/parser-cache.d.ts +5 -0
- package/dist/plugins/hatena/parser.d.ts +129 -0
- package/dist/plugins/hatena/pre.d.ts +3 -0
- package/dist/plugins/hatena/shared.d.ts +31 -0
- package/dist/plugins/hatena/super-pre.d.ts +23 -0
- package/dist/plugins/hatena/table.d.ts +12 -0
- package/dist/plugins/image-kit.d.ts +84 -0
- package/dist/plugins/inline-notation-kit.d.ts +39 -0
- package/dist/plugins/inline-style-kit.d.ts +38 -0
- package/dist/plugins/link-url.d.ts +1 -0
- package/dist/plugins/logical-lines.d.ts +18 -0
- package/dist/plugins/mbox/bracket.d.ts +4 -0
- package/dist/plugins/mbox/code-block.d.ts +32 -0
- package/dist/plugins/mbox/complete.d.ts +33 -0
- package/dist/plugins/mbox/default.d.ts +13 -0
- package/dist/plugins/mbox/emoji.d.ts +3 -0
- package/dist/plugins/mbox/footnote.d.ts +14 -0
- package/dist/plugins/mbox/heading.d.ts +10 -0
- package/dist/plugins/mbox/inline-code.d.ts +6 -0
- package/dist/plugins/mbox/inline-style.d.ts +7 -0
- package/dist/plugins/mbox/inline-visitor.d.ts +8 -0
- package/dist/plugins/mbox/list.d.ts +13 -0
- package/dist/plugins/mbox/markdown-image.d.ts +13 -0
- package/dist/plugins/mbox/page-link.d.ts +19 -0
- package/dist/plugins/mbox/paragraph.d.ts +6 -0
- package/dist/plugins/mbox/parser-cache.d.ts +3 -0
- package/dist/plugins/mbox/parser.d.ts +2 -0
- package/dist/plugins/mbox/quote.d.ts +5 -0
- package/dist/plugins/mbox/table.d.ts +13 -0
- package/dist/plugins/mbox/task-list.d.ts +19 -0
- package/dist/plugins/mbox/types.d.ts +172 -0
- package/dist/plugins/mbox/url-link.d.ts +3 -0
- package/dist/plugins/mbox/vertical-motion.d.ts +3 -0
- package/dist/plugins/pipe-table-row.d.ts +18 -0
- package/dist/plugins/scrapbox/bracket.d.ts +20 -0
- package/dist/plugins/scrapbox/code-block.d.ts +37 -0
- package/dist/plugins/scrapbox/command-line.d.ts +9 -0
- package/dist/plugins/scrapbox/complete.d.ts +58 -0
- package/dist/plugins/scrapbox/decoration.d.ts +16 -0
- package/dist/plugins/scrapbox/formula.d.ts +43 -0
- package/dist/plugins/scrapbox/image.d.ts +62 -0
- package/dist/plugins/scrapbox/indent.d.ts +40 -0
- package/dist/plugins/scrapbox/index.d.ts +41 -0
- package/dist/plugins/scrapbox/inline-code-highlight.d.ts +16 -0
- package/dist/plugins/scrapbox/inline-code.d.ts +7 -0
- package/dist/plugins/scrapbox/inline-scanner-kit.d.ts +66 -0
- package/dist/plugins/scrapbox/inline-walker.d.ts +2 -0
- package/dist/plugins/scrapbox/inline.d.ts +86 -0
- package/dist/plugins/scrapbox/link.d.ts +110 -0
- package/dist/plugins/scrapbox/list.d.ts +21 -0
- package/dist/plugins/scrapbox/parser-cache.d.ts +5 -0
- package/dist/plugins/scrapbox/parser.d.ts +65 -0
- package/dist/plugins/scrapbox/quote.d.ts +7 -0
- package/dist/plugins/scrapbox/table.d.ts +22 -0
- package/dist/plugins/scrapbox/title.d.ts +3 -0
- package/dist/plugins/scrapbox/visible-lines.d.ts +34 -0
- package/dist/plugins/table-kit.d.ts +142 -0
- package/dist/plugins/task-checkbox-kit.d.ts +18 -0
- package/dist/scrapbox.d.ts +42 -0
- package/dist/scrapbox.js +1903 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +13 -0
- package/dist/themes/code-token-presentation.d.ts +6 -0
- package/dist/themes/default-presentation.d.ts +4 -0
- package/dist/themes/gfm-presentation.d.ts +15 -0
- package/dist/themes/hatena-presentation.d.ts +10 -0
- package/dist/themes/heading-presentation.d.ts +18 -0
- package/dist/themes/scrapbox-presentation.d.ts +10 -0
- package/docs/guide.md +297 -0
- package/package.json +121 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 futaba-soft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mbox
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A structured text editor built on [CodeMirror 6](https://codemirror.net/). Only the focused line shows its raw syntax; every other line has its syntax hidden or replaced with a rendered representation, so the document always reads close to its finished form while you edit.
|
|
4
|
+
|
|
5
|
+
The four notations that ship — mbox's own, GFM, Scrapbox, Hatena — are each just a list of `MboxPlugin`s. Yours would be too.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
**Live demo:** [mbox notation](https://futaba-soft.github.io/mbox/) · [GFM](https://futaba-soft.github.io/mbox/demos/gfm.html) · [Scrapbox](https://futaba-soft.github.io/mbox/demos/scrapbox.html) · [Hatena](https://futaba-soft.github.io/mbox/demos/hatena.html)
|
|
10
|
+
|
|
11
|
+
> **Status:** pre-1.0. The package's exports are supported API, but they may still change before the 1.0 release.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm install @futaba-soft/mbox
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
CodeMirror packages are peer dependencies, installed automatically by npm 7+ and by pnpm's default `autoInstallPeers`; Yarn expects your project to provide them. ESM-only; the editor needs the DOM, so in SSR frameworks construct it client-side.
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createGfmEditor } from "@futaba-soft/mbox/gfm";
|
|
25
|
+
|
|
26
|
+
createGfmEditor({
|
|
27
|
+
parent: document.querySelector("#editor")!,
|
|
28
|
+
doc: "# Hello\n\nSome **GFM** text.",
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Each notation lives at its own sub-path with the same API:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { createGfmEditor } from "@futaba-soft/mbox/gfm"; // GitHub Flavored Markdown
|
|
36
|
+
import { createScrapboxEditor } from "@futaba-soft/mbox/scrapbox"; // Scrapbox notation
|
|
37
|
+
import { createHatenaEditor } from "@futaba-soft/mbox/hatena"; // Hatena notation
|
|
38
|
+
import { createMboxEditor } from "@futaba-soft/mbox"; // mbox's own notation
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Going further
|
|
42
|
+
|
|
43
|
+
The [guide](./docs/guide.md) covers the rest of the public API:
|
|
44
|
+
|
|
45
|
+
- Reacting to edits, React integration, and passing your own CodeMirror `extensions`
|
|
46
|
+
- `readOnly: true` — a non-editing, always-rendered display mode, not a security boundary for untrusted input
|
|
47
|
+
- Writing plugins and whole notations, and testing them with `@futaba-soft/mbox/testing`
|
|
48
|
+
- Styling: default presentation themes, `.mbox-*` class names, CSS variables
|
|
49
|
+
- What counts as supported API, and troubleshooting
|
|
50
|
+
|
|
51
|
+
For working on mbox itself, see [CONTRIBUTING.md](https://github.com/futaba-soft/mbox/blob/main/CONTRIBUTING.md) and [TESTING.md](https://github.com/futaba-soft/mbox/blob/main/TESTING.md).
|
|
52
|
+
|
|
53
|
+
## Untrusted content
|
|
54
|
+
|
|
55
|
+
mbox parses and renders structured text, but hosts are responsible for the
|
|
56
|
+
resource and navigation policies used when displaying untrusted documents. It
|
|
57
|
+
provides no input-size, CPU, or interruption limits, and its document cache
|
|
58
|
+
reparses the full document on every edit; apply limits before fetching,
|
|
59
|
+
decoding, pasting, or programmatic updates.
|
|
60
|
+
|
|
61
|
+
**The GFM namespace renders images by default, so it fetches the image URLs a
|
|
62
|
+
document contains.** GitHub proxies those requests; mbox does not, so the
|
|
63
|
+
reader's browser contacts whatever host the document names. If that is not what
|
|
64
|
+
you want, pass `image: { renderMode: "token" }` explicitly — alt text only, no
|
|
65
|
+
network. The mbox and Scrapbox namespaces still default to `"token"`.
|
|
66
|
+
|
|
67
|
+
Whichever mode you choose, apply your own URL, network, CSP, and privacy
|
|
68
|
+
policies. GFM links, including `linkUrl` results, are allowlist-checked; image
|
|
69
|
+
URLs and host resolver results remain the host's responsibility. Prefer an
|
|
70
|
+
explicit `codeHighlight: { languages: [...] }` allowlist over `languages:
|
|
71
|
+
"all"`.
|
|
72
|
+
|
|
73
|
+
mbox puts **no width limit on a rendered image** except inside a GFM table
|
|
74
|
+
cell, so an image is as large as the source file unless your CSS says
|
|
75
|
+
otherwise. See the guide's "GFM images and how wide they get".
|
|
76
|
+
|
|
77
|
+
See [SECURITY.md](https://github.com/futaba-soft/mbox/blob/main/SECURITY.md#untrusted-content) for the full guidance.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
[MIT](./LICENSE)
|