@seed-hypermedia/client 0.0.81 → 0.0.82
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/dist/block-diff.mjs +1 -1
- package/dist/blocks-to-markdown.d.ts +16 -11
- package/dist/blocks-to-markdown.mjs +1 -1
- package/dist/{chunk-OZKQOI2X.mjs → chunk-3KLY2B27.mjs} +51 -4
- package/dist/{chunk-YH52VFVR.mjs → chunk-TET43O3D.mjs} +296 -178
- package/dist/chunk-XB6E7EVC.mjs +872 -0
- package/dist/index.mjs +3 -3
- package/dist/markdown-to-blocks.d.ts +27 -32
- package/dist/markdown-to-blocks.mjs +3 -1
- package/package.json +1 -1
- package/dist/chunk-H7L4TI6X.mjs +0 -705
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
parseFrontmatter,
|
|
8
8
|
parseInlineFormatting,
|
|
9
9
|
parseMarkdown
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XB6E7EVC.mjs";
|
|
11
11
|
import {
|
|
12
12
|
pdfToBlocks
|
|
13
13
|
} from "./chunk-LCKCG574.mjs";
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
matchBlockIds,
|
|
110
110
|
rebindTableIdentities,
|
|
111
111
|
toAPIBlockNode
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-3KLY2B27.mjs";
|
|
113
113
|
import {
|
|
114
114
|
blocksToMarkdown,
|
|
115
115
|
commentToResolvedMarkdown,
|
|
@@ -119,7 +119,7 @@ import {
|
|
|
119
119
|
emitFrontmatter,
|
|
120
120
|
parseDraftFilename,
|
|
121
121
|
slugify
|
|
122
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-TET43O3D.mjs";
|
|
123
123
|
import {
|
|
124
124
|
createCapability,
|
|
125
125
|
resolveCapability
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Markdown → Seed block tree parser.
|
|
3
|
-
*
|
|
4
|
-
* Converts markdown content into a tree of Seed Hypermedia blocks
|
|
5
|
-
* with proper hierarchy: headings contain their content as children,
|
|
6
|
-
* lists use childrenType attributes, and inline formatting becomes
|
|
7
|
-
* annotations.
|
|
8
|
-
*
|
|
9
|
-
* Supports:
|
|
10
|
-
* - YAML frontmatter (--- delimited) for metadata extraction
|
|
11
|
-
* -  image syntax for Image blocks
|
|
12
|
-
* - $$ delimited math blocks
|
|
13
|
-
* - Block ID preservation via <!-- id:XXXXXXXX --> HTML comments
|
|
14
|
-
* - `title:` as backward-compatible alias for `name:` in frontmatter
|
|
15
|
-
*/
|
|
16
|
-
import type { HMBlockNode, HMMetadata } from './hm-types';
|
|
17
1
|
import type { DocumentOperation } from './change';
|
|
2
|
+
import type { HMBlockNode, HMMetadata } from './hm-types';
|
|
18
3
|
export type Annotation = {
|
|
19
4
|
type: string;
|
|
20
5
|
starts: number[];
|
|
21
6
|
ends: number[];
|
|
22
7
|
link?: string;
|
|
8
|
+
attributes?: Record<string, unknown>;
|
|
23
9
|
};
|
|
24
10
|
export type SeedBlock = {
|
|
25
11
|
type: string;
|
|
@@ -47,17 +33,33 @@ type InlineParseResult = {
|
|
|
47
33
|
};
|
|
48
34
|
/**
|
|
49
35
|
* Parses inline markdown formatting into plain text + annotation spans.
|
|
50
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* Supports `**bold**`, `_italic_` / `*italic*`, `~~strike~~`, `` `code` ``,
|
|
38
|
+
* `<u>`, `<mark>`, `<span style="…">`, `<br>`, `[text](url)`, `<url>`
|
|
39
|
+
* autolinks (hm:// → Embed, else Link) and backslash escapes. Markers are
|
|
40
|
+
* matched with a stack, so well-nested output from the emitter parses
|
|
41
|
+
* exactly; mis-nested hand-written input degrades gracefully.
|
|
51
42
|
*/
|
|
52
43
|
export declare function parseInlineFormatting(raw: string): InlineParseResult;
|
|
44
|
+
/**
|
|
45
|
+
* Merge annotations of the same kind whose ranges touch or overlap into one
|
|
46
|
+
* contiguous range, and order the result deterministically. The emitter
|
|
47
|
+
* splits annotations at every boundary to keep markers well nested, so this
|
|
48
|
+
* is what makes `parse(emit(doc))` equal `doc`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function mergeAdjacentAnnotations(annotations: Annotation[]): Annotation[];
|
|
51
|
+
export type BlockComment = {
|
|
52
|
+
id: string;
|
|
53
|
+
type?: string;
|
|
54
|
+
attrs?: Record<string, unknown>;
|
|
55
|
+
};
|
|
53
56
|
/**
|
|
54
57
|
* Strip YAML frontmatter (--- delimited) from markdown content.
|
|
55
|
-
* Returns the remaining content and
|
|
58
|
+
* Returns the remaining content and the parsed metadata.
|
|
56
59
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* Also accepts `title:` as a backward-compatible alias for `name:`.
|
|
60
|
+
* Every frontmatter key maps 1:1 to a metadata key, including nested values
|
|
61
|
+
* and keys this client does not know (schema-typed documents carry their
|
|
62
|
+
* own). `title:` is accepted as a backward-compatible alias for `name:`.
|
|
61
63
|
*/
|
|
62
64
|
export declare function parseFrontmatter(markdown: string): {
|
|
63
65
|
content: string;
|
|
@@ -66,16 +68,9 @@ export declare function parseFrontmatter(markdown: string): {
|
|
|
66
68
|
/**
|
|
67
69
|
* Builds a hierarchical block tree from markdown.
|
|
68
70
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* - Content before the first heading goes to root level
|
|
73
|
-
*
|
|
74
|
-
* YAML frontmatter (--- delimited) is parsed for document metadata
|
|
75
|
-
* (all HMMetadata fields) and stripped from the content before tokenizing.
|
|
76
|
-
*
|
|
77
|
-
* Block IDs from `<!-- id:XXXXXXXX -->` HTML comments are preserved.
|
|
78
|
-
* When no ID is present, random 8-char IDs are generated.
|
|
71
|
+
* See the module header for the dialect. Frontmatter is parsed for document
|
|
72
|
+
* metadata and stripped from the content before tokenizing. Block IDs from
|
|
73
|
+
* `<!-- id:… -->` comments are preserved; absent ids are generated.
|
|
79
74
|
*/
|
|
80
75
|
export declare function parseMarkdown(markdown: string): {
|
|
81
76
|
tree: BlockNode[];
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
flattenToOperations,
|
|
3
3
|
markdownBlockNodesToHMBlockNodes,
|
|
4
|
+
mergeAdjacentAnnotations,
|
|
4
5
|
parseFrontmatter,
|
|
5
6
|
parseInlineFormatting,
|
|
6
7
|
parseMarkdown
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XB6E7EVC.mjs";
|
|
8
9
|
import "./chunk-7P6ASYW6.mjs";
|
|
9
10
|
export {
|
|
10
11
|
flattenToOperations,
|
|
11
12
|
markdownBlockNodesToHMBlockNodes,
|
|
13
|
+
mergeAdjacentAnnotations,
|
|
12
14
|
parseFrontmatter,
|
|
13
15
|
parseInlineFormatting,
|
|
14
16
|
parseMarkdown
|