@type32/codemirror-rich-obsidian-editor 0.0.7 → 0.0.8

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@type32/codemirror-rich-obsidian-editor",
3
3
  "configKey": "cmOfmEditor",
4
- "version": "0.0.7",
4
+ "version": "0.0.8",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -20,6 +20,7 @@ const module = defineNuxtModule({
20
20
  path: resolver.resolve("./runtime/components")
21
21
  });
22
22
  addImportsDir(resolver.resolve("./runtime/composables"));
23
+ addImportsDir(resolver.resolve("./runtime/utils"));
23
24
  }
24
25
  });
25
26
 
@@ -0,0 +1,4 @@
1
+ export declare function parseFrontmatter(markdown: string): {
2
+ data?: Record<string, any>;
3
+ error?: Error;
4
+ };
@@ -0,0 +1,24 @@
1
+ import { load } from "js-yaml";
2
+ const frontmatterRegex = /^---\r?\n([\s\S]+?)\r?\n---/;
3
+ export function parseFrontmatter(markdown) {
4
+ if (!markdown) {
5
+ return {};
6
+ }
7
+ const match = markdown.match(frontmatterRegex);
8
+ if (!match) {
9
+ if (markdown.startsWith("---")) {
10
+ return { error: new Error("Incomplete frontmatter block.") };
11
+ }
12
+ return {};
13
+ }
14
+ const yamlContent = match[1];
15
+ try {
16
+ const data = load(yamlContent || "");
17
+ if (typeof data === "object" && data !== null) {
18
+ return { data };
19
+ }
20
+ return { error: new Error("Frontmatter is not a valid object.") };
21
+ } catch (e) {
22
+ return { error: e };
23
+ }
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@type32/codemirror-rich-obsidian-editor",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "OFM Editor Component for Nuxt.",
5
5
  "repository": "Type-32/codemirror-rich-obsidian",
6
6
  "license": "MIT",
@@ -35,13 +35,6 @@
35
35
  "test:types": "bunx vue-tsc --noEmit && cd playground && bunx vue-tsc --noEmit"
36
36
  },
37
37
  "dependencies": {
38
- "@nuxt/kit": "^4.1.1",
39
- "codemirror": "^6.0.2",
40
- "katex": "^0.16.22",
41
- "lezer-markdown-obsidian": "^0.0.3",
42
- "markdown-it": "^14.1.0",
43
- "markdown-it-obsidian-callouts": "^0.3.2",
44
- "vue-codemirror6": "^1.3.22",
45
38
  "@codemirror/autocomplete": "^6.18.7",
46
39
  "@codemirror/lang-json": "^6.0.2",
47
40
  "@codemirror/lang-markdown": "^6.3.4",
@@ -50,26 +43,35 @@
50
43
  "@codemirror/language-data": "^6.5.1",
51
44
  "@hsorby/vue3-katex": "0.6.0-rc.7",
52
45
  "@lezer/markdown": "^1.4.3",
46
+ "@nuxt/image": "1.10.0",
47
+ "@nuxt/kit": "^4.1.1",
53
48
  "@nuxt/ui": "^4.0.0-alpha.1",
54
- "@nuxt/image": "1.10.0"
49
+ "codemirror": "^6.0.2",
50
+ "js-yaml": "^4.1.0",
51
+ "katex": "^0.16.22",
52
+ "lezer-markdown-obsidian": "^0.0.3",
53
+ "markdown-it": "^14.1.0",
54
+ "markdown-it-obsidian-callouts": "^0.3.2",
55
+ "vue-codemirror6": "^1.3.22"
55
56
  },
56
57
  "devDependencies": {
58
+ "@iconify-json/lucide": "^1.2.66",
59
+ "@iconify-json/simple-icons": "^1.2.50",
57
60
  "@nuxt/devtools": "^2.6.3",
58
61
  "@nuxt/eslint-config": "^1.9.0",
62
+ "@nuxt/fonts": "0.11.4",
63
+ "@nuxt/icon": "1.15.0",
59
64
  "@nuxt/module-builder": "^1.0.2",
60
65
  "@nuxt/schema": "^4.1.1",
61
66
  "@nuxt/test-utils": "^3.19.2",
67
+ "@types/js-yaml": "^4.0.9",
62
68
  "@types/node": "latest",
63
69
  "changelogen": "^0.6.2",
64
70
  "eslint": "^9.35.0",
65
71
  "nuxt": "^4.1.1",
66
72
  "typescript": "~5.9.2",
67
73
  "vitest": "^3.2.4",
68
- "vue-tsc": "^3.0.6",
69
- "@iconify-json/lucide": "^1.2.66",
70
- "@iconify-json/simple-icons": "^1.2.50",
71
- "@nuxt/fonts": "0.11.4",
72
- "@nuxt/icon": "1.15.0"
74
+ "vue-tsc": "^3.0.6"
73
75
  },
74
76
  "trustedDependencies": [
75
77
  "@parcel/watcher",