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

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.9",
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
 
@@ -27,7 +27,7 @@ function internalLinkSource(context) {
27
27
  const linkMap = context.state.facet(internalLinkMapFacet);
28
28
  const options = linkMap.filter((link) => link.internalLinkName.toLowerCase().includes(textBefore.toLowerCase())).map((link) => ({
29
29
  label: link.internalLinkName,
30
- detail: link.redirectToPath,
30
+ detail: link.filePath,
31
31
  apply: `${link.internalLinkName}`
32
32
  }));
33
33
  if (options.length === 0) return null;
@@ -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,80 +1,85 @@
1
1
  {
2
- "name": "@type32/codemirror-rich-obsidian-editor",
3
- "version": "0.0.7",
4
- "description": "OFM Editor Component for Nuxt.",
5
- "repository": "Type-32/codemirror-rich-obsidian",
6
- "license": "MIT",
7
- "type": "module",
8
- "private": false,
9
- "exports": {
10
- ".": {
11
- "types": "./dist/types.d.mts",
12
- "import": "./dist/module.mjs"
13
- }
14
- },
15
- "main": "./dist/module.mjs",
16
- "typesVersions": {
17
- "*": {
18
- ".": [
19
- "./dist/types.d.mts"
20
- ]
21
- }
22
- },
23
- "files": [
24
- "dist"
25
- ],
26
- "scripts": {
27
- "prepack": "bunx nuxt-module-build build",
28
- "dev": "bun run dev:prepare && bunx nuxi dev playground",
29
- "dev:build": "bunx nuxi build playground",
30
- "dev:prepare": "bunx nuxt-module-build build --stub && bunx nuxt-module-build prepare && bunx nuxi prepare playground",
31
- "release": "bun run prepack && bunx changelogen --release && bun publish && git push --follow-tags",
32
- "lint": "bunx eslint .",
33
- "test": "bunx vitest run",
34
- "test:watch": "bunx vitest watch",
35
- "test:types": "bunx vue-tsc --noEmit && cd playground && bunx vue-tsc --noEmit"
36
- },
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
- "@codemirror/autocomplete": "^6.18.7",
46
- "@codemirror/lang-json": "^6.0.2",
47
- "@codemirror/lang-markdown": "^6.3.4",
48
- "@codemirror/lang-yaml": "^6.1.2",
49
- "@codemirror/language": "^6.11.3",
50
- "@codemirror/language-data": "^6.5.1",
51
- "@hsorby/vue3-katex": "0.6.0-rc.7",
52
- "@lezer/markdown": "^1.4.3",
53
- "@nuxt/ui": "^4.0.0-alpha.1",
54
- "@nuxt/image": "1.10.0"
55
- },
56
- "devDependencies": {
57
- "@nuxt/devtools": "^2.6.3",
58
- "@nuxt/eslint-config": "^1.9.0",
59
- "@nuxt/module-builder": "^1.0.2",
60
- "@nuxt/schema": "^4.1.1",
61
- "@nuxt/test-utils": "^3.19.2",
62
- "@types/node": "latest",
63
- "changelogen": "^0.6.2",
64
- "eslint": "^9.35.0",
65
- "nuxt": "^4.1.1",
66
- "typescript": "~5.9.2",
67
- "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"
73
- },
74
- "trustedDependencies": [
75
- "@parcel/watcher",
76
- "@tailwindcss/oxide",
77
- "core-js",
78
- "unrs-resolver"
79
- ]
2
+ "name": "@type32/codemirror-rich-obsidian-editor",
3
+ "version": "0.0.9",
4
+ "description": "OFM Editor Component for Nuxt.",
5
+ "repository": "Type-32/codemirror-rich-obsidian",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "private": false,
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types.d.mts",
12
+ "import": "./dist/module.mjs"
13
+ }
14
+ },
15
+ "main": "./dist/module.mjs",
16
+ "typesVersions": {
17
+ "*": {
18
+ ".": [
19
+ "./dist/types.d.mts"
20
+ ]
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "prepack": "bunx nuxt-module-build build",
28
+ "dev": "bun run dev:prepare && bunx nuxi dev playground",
29
+ "dev:build": "bunx nuxi build playground",
30
+ "dev:prepare": "bunx nuxt-module-build build --stub && bunx nuxt-module-build prepare && bunx nuxi prepare playground",
31
+ "release": "bun run prepack && bunx changelogen --release && bun publish && git push --follow-tags",
32
+ "lint": "bunx eslint .",
33
+ "test": "bunx vitest run",
34
+ "test:watch": "bunx vitest watch",
35
+ "test:types": "bunx vue-tsc --noEmit && cd playground && bunx vue-tsc --noEmit"
36
+ },
37
+ "dependencies": {
38
+ "@codemirror/autocomplete": "^6.18.7",
39
+ "@codemirror/lang-json": "^6.0.2",
40
+ "@codemirror/lang-markdown": "^6.3.4",
41
+ "@codemirror/lang-yaml": "^6.1.2",
42
+ "@codemirror/language": "^6.11.3",
43
+ "@codemirror/language-data": "^6.5.1",
44
+ "@hsorby/vue3-katex": "0.6.0-rc.7",
45
+ "@lezer/markdown": "^1.4.3",
46
+ "@nuxt/image": "1.10.0",
47
+ "@nuxt/kit": "^4.1.2",
48
+ "@nuxt/ui": "^4.0.0-alpha.1",
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"
56
+ },
57
+ "devDependencies": {
58
+ "@iconify-json/lucide": "^1.2.67",
59
+ "@iconify-json/simple-icons": "^1.2.51",
60
+ "@nuxt/devtools": "^2.6.3",
61
+ "@nuxt/eslint-config": "^1.9.0",
62
+ "@nuxt/fonts": "0.11.4",
63
+ "@nuxt/icon": "1.15.0",
64
+ "@nuxt/module-builder": "^1.0.2",
65
+ "@nuxt/schema": "^4.1.2",
66
+ "@nuxt/test-utils": "^3.19.2",
67
+ "@types/js-yaml": "^4.0.9",
68
+ "@types/node": "latest",
69
+ "changelogen": "^0.6.2",
70
+ "eslint": "^9.35.0",
71
+ "nuxt": "^4.1.2",
72
+ "typescript": "~5.9.2",
73
+ "vitest": "^3.2.4",
74
+ "vue-tsc": "^3.0.7"
75
+ },
76
+ "trustedDependencies": [
77
+ "@parcel/watcher",
78
+ "@tailwindcss/oxide",
79
+ "core-js",
80
+ "esbuild",
81
+ "sharp",
82
+ "unrs-resolver",
83
+ "vue-demi"
84
+ ]
80
85
  }