@kungal/editor-core 0.34.0 → 0.36.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/CHANGELOG.md +71 -0
- package/dist/chunk-IIVFLZTN.js +50 -0
- package/dist/chunk-IIVFLZTN.js.map +1 -0
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +1 -1
- package/dist/preset/index.cjs +100 -9
- package/dist/preset/index.cjs.map +1 -1
- package/dist/preset/index.d.cts +34 -4
- package/dist/preset/index.d.ts +34 -4
- package/dist/preset/index.js +78 -9
- package/dist/preset/index.js.map +1 -1
- package/dist/{types-Dui0tGlh.d.cts → types-f8Szrgvw.d.cts} +4 -0
- package/dist/{types-Dui0tGlh.d.ts → types-f8Szrgvw.d.ts} +4 -0
- package/package.json +1 -1
- package/dist/chunk-PT42ZQGO.js +0 -30
- package/dist/chunk-PT42ZQGO.js.map +0 -1
package/dist/chunk-PT42ZQGO.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// src/outline.ts
|
|
2
|
-
var FENCE = /^\s{0,3}(?:```|~~~)/;
|
|
3
|
-
var ATX = /^ {0,3}(#{1,6})\s+(.+?)\s*#*\s*$/;
|
|
4
|
-
var parseHeadings = (markdown) => {
|
|
5
|
-
const out = [];
|
|
6
|
-
let inFence = false;
|
|
7
|
-
for (const line of markdown.split("\n")) {
|
|
8
|
-
if (FENCE.test(line)) {
|
|
9
|
-
inFence = !inFence;
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
if (inFence) {
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
const m = line.match(ATX);
|
|
16
|
-
if (m) {
|
|
17
|
-
out.push({ level: m[1].length, text: m[2].trim() });
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return out;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// src/index.ts
|
|
24
|
-
var MENTION_SCHEME = "kungal-user:";
|
|
25
|
-
var QUOTE_SCHEME = "kungal-reply:";
|
|
26
|
-
var KUN_EDITOR_CORE_VERSION = "0.0.0";
|
|
27
|
-
|
|
28
|
-
export { KUN_EDITOR_CORE_VERSION, MENTION_SCHEME, QUOTE_SCHEME, parseHeadings };
|
|
29
|
-
//# sourceMappingURL=chunk-PT42ZQGO.js.map
|
|
30
|
-
//# sourceMappingURL=chunk-PT42ZQGO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/outline.ts","../src/index.ts"],"names":[],"mappings":";AAgBA,IAAM,KAAA,GAAQ,qBAAA;AACd,IAAM,GAAA,GAAM,kCAAA;AAGL,IAAM,aAAA,GAAgB,CAAC,QAAA,KAAmC;AAC/D,EAAA,MAAM,MAAoB,EAAC;AAC3B,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,KAAA,MAAW,IAAA,IAAQ,QAAA,CAAS,KAAA,CAAM,IAAI,CAAA,EAAG;AACvC,IAAA,IAAI,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,EAAG;AACpB,MAAA,OAAA,GAAU,CAAC,OAAA;AACX,MAAA;AAAA,IACF;AACA,IAAA,IAAI,OAAA,EAAS;AACX,MAAA;AAAA,IACF;AACA,IAAA,MAAM,CAAA,GAAI,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AACxB,IAAA,IAAI,CAAA,EAAG;AACL,MAAA,GAAA,CAAI,IAAA,CAAK,EAAE,KAAA,EAAO,CAAA,CAAE,CAAC,CAAA,CAAG,MAAA,EAAQ,IAAA,EAAM,CAAA,CAAE,CAAC,CAAA,CAAG,IAAA,IAAQ,CAAA;AAAA,IACtD;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT;;;ACtBO,IAAM,cAAA,GAAiB;AAMvB,IAAM,YAAA,GAAe;AAErB,IAAM,uBAAA,GAA0B","file":"chunk-PT42ZQGO.js","sourcesContent":["// Heading outline (table-of-contents) parsing — pure, zero-dep, so it lives in\n// the light main entry (a host, or the server, can build a TOC without pulling in\n// @milkdown/kit). Parses ATX headings (`#`…`######`) — what the toolbar produces\n// — and skips fenced code blocks so a `# comment` inside ``` isn't mistaken for a\n// heading. Setext headings (underlined) are intentionally not parsed.\n//\n// The result is an ordered list; a UI renders it and, on click, calls the\n// editor's `scrollToHeading(index)` with the item's array index.\n\nexport interface KunHeading {\n /** Heading level 1–6. */\n level: number\n /** The heading's text (trailing `#` closers stripped). */\n text: string\n}\n\nconst FENCE = /^\\s{0,3}(?:```|~~~)/\nconst ATX = /^ {0,3}(#{1,6})\\s+(.+?)\\s*#*\\s*$/\n\n/** Parse the ordered ATX-heading outline from a markdown string. */\nexport const parseHeadings = (markdown: string): KunHeading[] => {\n const out: KunHeading[] = []\n let inFence = false\n for (const line of markdown.split('\\n')) {\n if (FENCE.test(line)) {\n inFence = !inFence\n continue\n }\n if (inFence) {\n continue\n }\n const m = line.match(ATX)\n if (m) {\n out.push({ level: m[1]!.length, text: m[2]!.trim() })\n }\n }\n return out\n}\n","// @kungal/editor-core — public entry.\n//\n// STATUS: scaffold. The adapter contracts (the stable public surface) are\n// defined and exported now; the Milkdown plugin ports land incrementally per\n// docs/architecture.md § migration. Consumers should code against the types\n// below — those are the contract that will not churn as plugins move over.\n\nexport * from './types'\n\n// Heading outline (TOC) parsing — pure, so it's here in the light entry.\nexport * from './outline'\n\n// Markdown scheme used to encode an @mention as a plain link the server can\n// render + parse: `[@name](kungal-user:<id>)`. Lives here (not the plugin) so\n// hosts and the server can share the exact string. See ./plugins/mention.\nexport const MENTION_SCHEME = 'kungal-user:'\n\n// Markdown scheme for an inline reference (reply quote): `[label](kungal-reply:<refId>)`.\n// Like MENTION_SCHEME, shared with the server renderer so both agree on the\n// exact string. The reference is opaque here — the host decides what `refId` /\n// `label` mean (see docs/architecture.md § the reply-quote question, option 1).\nexport const QUOTE_SCHEME = 'kungal-reply:'\n\nexport const KUN_EDITOR_CORE_VERSION = '0.0.0'\n\n// ── The Milkdown plugins live in the `./preset` subpath ──────────────────────\n// This main entry stays light on purpose: types + MENTION_SCHEME, ZERO runtime\n// deps, so the server (which only needs the @mention scheme string) can import\n// it without installing @milkdown/kit / katex / codemirror.\n//\n// The composed Milkdown bundle and the individual plugin factories are exported\n// from `@kungal/editor-core/preset` (they pull in the peer deps):\n//\n// import { createKunEditorPlugins } from '@kungal/editor-core/preset'\n//\n// P1 landed (docs/architecture.md § migration): spoiler, katex, code-block,\n// stop-link — each a factory (createXxxPlugin), never a host-bound singleton.\n// P2 adds the adapter-driven plugins (upload / mention / sticker).\n"]}
|