@cocoar/vue-markdown-core 2.6.0 → 2.8.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.
@@ -0,0 +1,28 @@
1
+ /**
2
+ * One displayable key/value row of a parsed YAML frontmatter block.
3
+ * `value` is already flattened to a human-readable string (nested objects /
4
+ * arrays are compacted) so renderers can drop it straight into a cell.
5
+ */
6
+ export interface FrontmatterEntry {
7
+ readonly key: string;
8
+ readonly value: string;
9
+ }
10
+ export interface ParsedFrontmatter {
11
+ /** The original YAML text, verbatim — the source of truth for round-trip. */
12
+ readonly raw: string;
13
+ /** The parsed YAML as an object, or `null` when it isn't a key/value map
14
+ * (parse error, or a top-level scalar/array). Renderers fall back to `raw`. */
15
+ readonly data: Readonly<Record<string, unknown>> | null;
16
+ /** Flattened, display-ready rows. Empty when `data` is `null`. */
17
+ readonly entries: readonly FrontmatterEntry[];
18
+ }
19
+ /**
20
+ * Parse a raw YAML frontmatter string into display-ready rows.
21
+ *
22
+ * Shared by the viewer (parse-time, stored on the node) and the editor's
23
+ * frontmatter NodeView (render-time, from the PM node's `value` attr) so both
24
+ * surfaces show the exact same metadata. Never throws — malformed YAML yields
25
+ * `data: null` + empty `entries`, and the caller shows the raw text instead.
26
+ */
27
+ export declare function parseFrontmatter(raw: string): ParsedFrontmatter;
28
+ //# sourceMappingURL=frontmatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;oFACgF;IAChF,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IACxD,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAgB/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/lib/parse.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAkC,MAAM,SAAS,CAAC;AAIhF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,gBAAgB,CAS5F"}
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/lib/parse.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAkC,MAAM,SAAS,CAAC;AAKhF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,gBAAgB,CAc5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/lib/serialize.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,SAAS,CAAC;AAG9D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,GAAE,wBAA6B,GAAG,MAAM,CAS/F"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/lib/serialize.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAgB,MAAM,SAAS,CAAC;AAG9D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,gBAAgB,EAAE,OAAO,GAAE,wBAA6B,GAAG,MAAM,CAa/F"}
@@ -4,7 +4,7 @@ export interface MarkdownPosition {
4
4
  readonly line: number;
5
5
  readonly column: number;
6
6
  }
7
- export type MarkdownNodeType = 'heading' | 'paragraph' | 'blockquote' | 'list' | 'listItem' | 'codeBlock' | 'table' | 'tableRow' | 'tableCell' | 'thematicBreak' | 'lineBreak' | 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'inlineCode' | 'link' | 'image' | 'colorSpan' | 'unsupported';
7
+ export type MarkdownNodeType = 'frontmatter' | 'heading' | 'paragraph' | 'blockquote' | 'list' | 'listItem' | 'codeBlock' | 'table' | 'tableRow' | 'tableCell' | 'thematicBreak' | 'lineBreak' | 'text' | 'emphasis' | 'strong' | 'strikethrough' | 'inlineCode' | 'link' | 'image' | 'colorSpan' | 'unsupported';
8
8
  export interface MarkdownNode {
9
9
  readonly id: string;
10
10
  readonly type: MarkdownNodeType | (string & {});
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,WAAW,GACX,YAAY,GACZ,MAAM,GACN,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,GACV,WAAW,GACX,e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GACf,WAAW,GACX,MAAM,GACN,UAAU,GACV,QAAQ,GACR,eAAe,GACf,YAAY,GACZ,MAAM,GACN,OAAO,GACP,WAAW,GACX,aAAa,CAAC;AAElB,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC5C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CACtC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACd,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,gBAAgB,KAAK,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocoar/vue-markdown-core",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "Core markdown parsing utilities for @cocoar/vue-markdown",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -38,7 +38,9 @@
38
38
  "unified": "^11.0.5",
39
39
  "remark-parse": "^11.0.0",
40
40
  "remark-stringify": "^11.0.0",
41
- "remark-gfm": "^4.0.1"
41
+ "remark-gfm": "^4.0.1",
42
+ "remark-frontmatter": "^5.0.0",
43
+ "yaml": "^2.8.0"
42
44
  },
43
45
  "devDependencies": {
44
46
  "@types/mdast": "^4.0.4"