vertex-notes 0.1.4 → 0.2.1

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.
Files changed (39) hide show
  1. package/dist/{chunk-4QLCD6TZ.js → chunk-EEEL6ZKK.js} +378 -43
  2. package/dist/chunk-EEEL6ZKK.js.map +1 -0
  3. package/dist/{chunk-DDFOKGIX.js → chunk-URRSVCB7.js} +2 -2
  4. package/dist/commands/capture.js +2 -2
  5. package/dist/commands/daily.js +2 -2
  6. package/dist/commands/delete.js +2 -2
  7. package/dist/commands/edit.js +3 -5
  8. package/dist/commands/edit.js.map +1 -1
  9. package/dist/commands/export.js +2 -2
  10. package/dist/commands/hello.js +1 -1
  11. package/dist/commands/help.js +23 -14
  12. package/dist/commands/help.js.map +1 -1
  13. package/dist/commands/howto.js +379 -0
  14. package/dist/commands/howto.js.map +1 -0
  15. package/dist/commands/import.js +39 -0
  16. package/dist/commands/import.js.map +1 -0
  17. package/dist/commands/interactive.js +187 -74
  18. package/dist/commands/interactive.js.map +1 -1
  19. package/dist/commands/login.js +1 -1
  20. package/dist/commands/new.js +2 -2
  21. package/dist/commands/notes.js +2 -2
  22. package/dist/commands/restore.js +2 -2
  23. package/dist/commands/search.js +2 -2
  24. package/dist/commands/status.js +2 -2
  25. package/dist/commands/syntax.js +276 -0
  26. package/dist/commands/syntax.js.map +1 -0
  27. package/dist/commands/tags.js +2 -2
  28. package/dist/commands/today.js +2 -2
  29. package/dist/commands/trash/empty.js +2 -2
  30. package/dist/commands/trash/index.js +2 -2
  31. package/dist/commands/view.js +2 -2
  32. package/dist/lib/client.js +2 -2
  33. package/dist/lib/md-to-tiptap.js +245 -3
  34. package/dist/lib/md-to-tiptap.js.map +1 -1
  35. package/package.json +2 -1
  36. package/dist/chunk-4QLCD6TZ.js.map +0 -1
  37. package/dist/chunk-FWK2J3FR.js +0 -163
  38. package/dist/chunk-FWK2J3FR.js.map +0 -1
  39. /package/dist/{chunk-DDFOKGIX.js.map → chunk-URRSVCB7.js.map} +0 -0
@@ -0,0 +1,276 @@
1
+ // src/commands/syntax.ts
2
+ import { Command } from "@oclif/core";
3
+ var D = "\x1B[90m";
4
+ var B = "\x1B[1m";
5
+ var C = "\x1B[36m";
6
+ var Y = "\x1B[33m";
7
+ var G = "\x1B[32m";
8
+ var P = "\x1B[35m";
9
+ var R = "\x1B[0m";
10
+ var Syntax = class extends Command {
11
+ static description = "Show all Vertex markdown syntax for writing notes";
12
+ async run() {
13
+ this.log(`
14
+ ${B}${P} Vertex Markdown Syntax \u2014 Complete Reference${R}
15
+ ${D} For AI agents and humans writing Vertex notes from the terminal.${R}
16
+ ${D} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${R}
17
+
18
+ ${C}${B} RULES${R}
19
+ ${D} \u2022 Each block must be separated by a blank line${R}
20
+ ${D} \u2022 First # Heading 1 in a note becomes the note title${R}
21
+ ${D} \u2022 Tags must start with a letter: #valid #123invalid${R}
22
+ ${D} \u2022 Wiki links are case-insensitive: [[My Note]] matches "my note"${R}
23
+ ${D} \u2022 Indent with spaces, not tabs${R}
24
+
25
+ ${C}${B} \u2501\u2501\u2501 TEXT & HEADINGS \u2501\u2501\u2501${R}
26
+
27
+ ${Y} # Heading 1${R} ${D}\u2190 note title${R}
28
+ ${Y} ## Heading 2${R} ${D}\u2190 section${R}
29
+ ${Y} ### Heading 3${R} ${D}\u2190 subsection${R}
30
+ ${Y} #### Heading 4${R} ${D}\u2190 minor heading${R}
31
+
32
+ ${Y} Plain paragraph text.${R} ${D}\u2190 just text on a line${R}
33
+ ${Y} **bold** *italic* \`code\` ~~strike~~${R}
34
+
35
+ ${C}${B} \u2501\u2501\u2501 LINKS & TAGS \u2501\u2501\u2501${R}
36
+
37
+ ${Y} [[Note Title]]${R} ${D}\u2190 wiki link (navigates to note)${R}
38
+ ${Y} #tagname${R} ${D}\u2190 tag (auto-created, purple pill)${R}
39
+ ${Y} #parent/child${R} ${D}\u2190 scoped tag (creates hierarchy)${R}
40
+ ${Y} #work/frontend${R} ${D}\u2190 example: parent=work, child=frontend${R}
41
+
42
+ ${C}${B} \u2501\u2501\u2501 LISTS \u2501\u2501\u2501${R}
43
+
44
+ ${Y} - Bullet item one${R}
45
+ ${Y} - Bullet item two${R}
46
+ ${Y} - Bullet item three${R}
47
+
48
+ ${Y} 1. Numbered item one${R}
49
+ ${Y} 2. Numbered item two${R}
50
+ ${Y} 3. Numbered item three${R}
51
+
52
+ ${Y} - [ ] Open todo task${R}
53
+ ${Y} - [x] Completed todo task${R}
54
+ ${Y} - [ ] Another open task #work${R} ${D}\u2190 tags work inside tasks${R}
55
+
56
+ ${C}${B} \u2501\u2501\u2501 BLOCKQUOTE \u2501\u2501\u2501${R}
57
+
58
+ ${Y} > Single line quote${R}
59
+
60
+ ${Y} > Multi-line quote${R}
61
+ ${Y} > continues with > prefix${R}
62
+ ${Y} > on each line${R}
63
+
64
+ ${C}${B} \u2501\u2501\u2501 DIVIDER \u2501\u2501\u2501${R}
65
+
66
+ ${Y} ---${R} ${D}\u2190 horizontal rule${R}
67
+
68
+ ${C}${B} \u2501\u2501\u2501 CODE BLOCK \u2501\u2501\u2501${R}
69
+
70
+ ${Y} \`\`\`javascript${R}
71
+ ${Y} function greet(name) {${R}
72
+ ${Y} return \`Hello, \${name}!\`;${R}
73
+ ${Y} }${R}
74
+ ${Y} \`\`\`${R}
75
+
76
+ ${D} Languages: python, javascript, typescript, rust, go, java,${R}
77
+ ${D} c, cpp, csharp, ruby, php, swift, kotlin, sql, html, css,${R}
78
+ ${D} json, yaml, xml, markdown, bash, shell, dockerfile, graphql${R}
79
+
80
+ ${C}${B} \u2501\u2501\u2501 MERMAID DIAGRAM \u2501\u2501\u2501${R}
81
+ ${D} Use \`\`\`mermaid to open, \`\`\` to close. All Mermaid syntax works.${R}
82
+
83
+ ${D} Flowchart:${R}
84
+ ${Y} \`\`\`mermaid${R}
85
+ ${Y} graph TD;${R}
86
+ ${Y} A[Start] --> B{Decision};${R}
87
+ ${Y} B -->|Yes| C[Do X];${R}
88
+ ${Y} B -->|No| D[Do Y];${R}
89
+ ${Y} C --> E[End];${R}
90
+ ${Y} D --> E;${R}
91
+ ${Y} \`\`\`${R}
92
+
93
+ ${D} Sequence diagram:${R}
94
+ ${Y} \`\`\`mermaid${R}
95
+ ${Y} sequenceDiagram${R}
96
+ ${Y} Client->>Server: Request${R}
97
+ ${Y} Server->>DB: Query${R}
98
+ ${Y} DB-->>Server: Result${R}
99
+ ${Y} Server-->>Client: Response${R}
100
+ ${Y} \`\`\`${R}
101
+
102
+ ${D} ER diagram:${R}
103
+ ${Y} \`\`\`mermaid${R}
104
+ ${Y} erDiagram${R}
105
+ ${Y} USER ||--o{ POST : writes${R}
106
+ ${Y} POST ||--o{ COMMENT : has${R}
107
+ ${Y} USER ||--o{ COMMENT : writes${R}
108
+ ${Y} \`\`\`${R}
109
+
110
+ ${D} Class diagram:${R}
111
+ ${Y} \`\`\`mermaid${R}
112
+ ${Y} classDiagram${R}
113
+ ${Y} class Animal {${R}
114
+ ${Y} +String name${R}
115
+ ${Y} +eat() void${R}
116
+ ${Y} }${R}
117
+ ${Y} Animal <|-- Dog${R}
118
+ ${Y} Animal <|-- Cat${R}
119
+ ${Y} \`\`\`${R}
120
+
121
+ ${D} Also: gantt, pie, stateDiagram, flowchart, gitGraph, mindmap${R}
122
+
123
+ ${C}${B} \u2501\u2501\u2501 MATH (LaTeX) \u2501\u2501\u2501${R}
124
+
125
+ ${C} Inline math (within text):${R}
126
+ ${Y} The formula $E = mc^2$ is famous.${R}
127
+ ${Y} Solve for $x$ where $ax^2 + bx + c = 0$.${R}
128
+
129
+ ${C} Block math (standalone):${R}
130
+ ${D} Use $$ on its own line to open and close. KaTeX syntax.${R}
131
+
132
+ ${Y} $$${R}
133
+ ${Y} E = mc^2${R}
134
+ ${Y} $$${R}
135
+
136
+ ${Y} $$${R}
137
+ ${Y} \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}${R}
138
+ ${Y} $$${R}
139
+
140
+ ${Y} $$${R}
141
+ ${Y} \\sum_{i=1}^{n} i = \\frac{n(n+1)}{2}${R}
142
+ ${Y} $$${R}
143
+
144
+ ${Y} $$${R}
145
+ ${Y} \\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}${R}
146
+ ${Y} $$${R}
147
+
148
+ ${D} Common LaTeX: \\frac{a}{b} \\sqrt{x} x^{2} x_{i}${R}
149
+ ${D} \\sum \\prod \\int \\lim \\infty \\alpha \\beta \\pi${R}
150
+ ${D} \\text{label} \\mathbb{R} \\vec{v} \\hat{x} \\bar{x}${R}
151
+ ${D} Matrices: \\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}${R}
152
+
153
+ ${C}${B} \u2501\u2501\u2501 CALLOUT BLOCKS \u2501\u2501\u2501${R}
154
+ ${D} 4 variants: info, warning, error, tip${R}
155
+
156
+ ${Y} > [!info]${R}
157
+ ${Y} > This is an informational note.${R}
158
+
159
+ ${Y} > [!warning]${R}
160
+ ${Y} > Be careful about this.${R}
161
+
162
+ ${Y} > [!error]${R}
163
+ ${Y} > Something went wrong.${R}
164
+
165
+ ${Y} > [!tip]${R}
166
+ ${Y} > Helpful suggestion here.${R}
167
+
168
+ ${D} Multi-line callout:${R}
169
+ ${Y} > [!info]${R}
170
+ ${Y} > Line one of the callout.${R}
171
+ ${Y} > Line two continues here.${R}
172
+ ${Y} > Each line needs the > prefix.${R}
173
+
174
+ ${C}${B} \u2501\u2501\u2501 QUERY BLOCK (live search) \u2501\u2501\u2501${R}
175
+
176
+ ${Y} > [!query]${R}
177
+ ${Y} > type:todo status:open${R}
178
+
179
+ ${Y} > [!query]${R}
180
+ ${Y} > #work type:todo${R}
181
+
182
+ ${D} Queries: keyword, #tag, type:todo/code/heading, status:open/done${R}
183
+
184
+ ${C}${B} \u2501\u2501\u2501 INLINE LINK \u2501\u2501\u2501${R}
185
+
186
+ ${Y} [Link Text](https://example.com)${R}
187
+ ${D} Opens in new tab. Works in paragraphs, lists, todos, callouts.${R}
188
+
189
+ ${C}${B} \u2501\u2501\u2501 EMBED (link preview) \u2501\u2501\u2501${R}
190
+
191
+ ${Y} > [!embed]${R}
192
+ ${Y} > https://www.youtube.com/watch?v=VIDEO_ID${R}
193
+
194
+ ${Y} > [!embed]${R}
195
+ ${Y} > https://github.com/user/repo${R}
196
+ ${D} YouTube \u2192 embedded video player${R}
197
+ ${D} Other URLs \u2192 preview card with title, description, image${R}
198
+
199
+ ${C}${B} \u2501\u2501\u2501 IMAGE \u2501\u2501\u2501${R}
200
+
201
+ ${Y} ![alt text](https://example.com/image.png)${R}
202
+
203
+ ${C}${B} \u2501\u2501\u2501 FILE ATTACHMENT \u2501\u2501\u2501${R}
204
+
205
+ ${Y} > [!file]${R}
206
+ ${Y} > [document.pdf](https://example.com/file.pdf)${R}
207
+ ${Y} > application/pdf 149780${R}
208
+
209
+ ${D} Format: > [filename](url) then > mimetype size_in_bytes${R}
210
+
211
+ ${D} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${R}
212
+
213
+ ${C}${B} COMMANDS${R}
214
+ ${G}vertex new "Title"${R} ${D}\u2190 create empty note${R}
215
+ ${G}vertex edit "Title"${R} ${D}\u2190 edit in $EDITOR${R}
216
+ ${G}vertex import file.md${R} ${D}\u2190 import markdown as new note${R}
217
+ ${G}vertex import file.md -t "T"${R} ${D}\u2190 import with custom title${R}
218
+ ${G}vertex export "Title"${R} ${D}\u2190 print as markdown${R}
219
+ ${G}vertex export "Title" -o out.md${R} ${D}\u2190 save to file${R}
220
+ ${G}vertex view "Title"${R} ${D}\u2190 quick view (same as export)${R}
221
+ ${G}vertex syntax${R} ${D}\u2190 this reference${R}
222
+
223
+ ${C}${B} AI USAGE${R}
224
+ ${D} Any AI can create Vertex notes. Write a .md file using${R}
225
+ ${D} the syntax above, then:${R}
226
+
227
+ ${G}vertex import note.md -t "My Note"${R}
228
+
229
+ ${D} Or edit an existing note directly:${R}
230
+
231
+ ${G}vertex edit "My Note"${R}
232
+
233
+ ${D} The note will render with rich blocks (mermaid diagrams,${R}
234
+ ${D} LaTeX math, syntax-highlighted code, callouts, etc.)${R}
235
+ ${D} in the Vertex web app at ${P}https://vertex-alu.pages.dev${R}
236
+
237
+ ${C}${B} FULL EXAMPLE${R}
238
+ ${D} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${R}
239
+ ${Y} # Project Notes${R}
240
+ ${Y} ${R}
241
+ ${Y} Overview of the #project with [[Related Note]] link.${R}
242
+ ${Y} ${R}
243
+ ${Y} ## Architecture${R}
244
+ ${Y} ${R}
245
+ ${Y} \`\`\`mermaid${R}
246
+ ${Y} graph LR;${R}
247
+ ${Y} Client --> API --> DB;${R}
248
+ ${Y} \`\`\`${R}
249
+ ${Y} ${R}
250
+ ${Y} ## Key Formula${R}
251
+ ${Y} ${R}
252
+ ${Y} $$${R}
253
+ ${Y} O(n \\log n)${R}
254
+ ${Y} $$${R}
255
+ ${Y} ${R}
256
+ ${Y} ## Code${R}
257
+ ${Y} ${R}
258
+ ${Y} \`\`\`python${R}
259
+ ${Y} print("hello")${R}
260
+ ${Y} \`\`\`${R}
261
+ ${Y} ${R}
262
+ ${Y} > [!tip]${R}
263
+ ${Y} > Remember to test edge cases.${R}
264
+ ${Y} ${R}
265
+ ${Y} ## Tasks${R}
266
+ ${Y} ${R}
267
+ ${Y} - [x] Design complete${R}
268
+ ${Y} - [ ] Implementation pending #work${R}
269
+ ${D} \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500${R}
270
+ `);
271
+ }
272
+ };
273
+ export {
274
+ Syntax as default
275
+ };
276
+ //# sourceMappingURL=syntax.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/syntax.ts"],"sourcesContent":["import { Command } from \"@oclif/core\";\n\nconst D = \"\\x1b[90m\";\nconst B = \"\\x1b[1m\";\nconst C = \"\\x1b[36m\";\nconst Y = \"\\x1b[33m\";\nconst G = \"\\x1b[32m\";\nconst P = \"\\x1b[35m\";\nconst R = \"\\x1b[0m\";\n\nexport default class Syntax extends Command {\n static override description = \"Show all Vertex markdown syntax for writing notes\";\n\n async run(): Promise<void> {\n this.log(`\n${B}${P} Vertex Markdown Syntax — Complete Reference${R}\n${D} For AI agents and humans writing Vertex notes from the terminal.${R}\n${D} ──────────────────────────────────────────────────────────${R}\n\n${C}${B} RULES${R}\n${D} • Each block must be separated by a blank line${R}\n${D} • First # Heading 1 in a note becomes the note title${R}\n${D} • Tags must start with a letter: #valid #123invalid${R}\n${D} • Wiki links are case-insensitive: [[My Note]] matches \"my note\"${R}\n${D} • Indent with spaces, not tabs${R}\n\n${C}${B} ━━━ TEXT & HEADINGS ━━━${R}\n\n${Y} # Heading 1${R} ${D}← note title${R}\n${Y} ## Heading 2${R} ${D}← section${R}\n${Y} ### Heading 3${R} ${D}← subsection${R}\n${Y} #### Heading 4${R} ${D}← minor heading${R}\n\n${Y} Plain paragraph text.${R} ${D}← just text on a line${R}\n${Y} **bold** *italic* \\`code\\` ~~strike~~${R}\n\n${C}${B} ━━━ LINKS & TAGS ━━━${R}\n\n${Y} [[Note Title]]${R} ${D}← wiki link (navigates to note)${R}\n${Y} #tagname${R} ${D}← tag (auto-created, purple pill)${R}\n${Y} #parent/child${R} ${D}← scoped tag (creates hierarchy)${R}\n${Y} #work/frontend${R} ${D}← example: parent=work, child=frontend${R}\n\n${C}${B} ━━━ LISTS ━━━${R}\n\n${Y} - Bullet item one${R}\n${Y} - Bullet item two${R}\n${Y} - Bullet item three${R}\n\n${Y} 1. Numbered item one${R}\n${Y} 2. Numbered item two${R}\n${Y} 3. Numbered item three${R}\n\n${Y} - [ ] Open todo task${R}\n${Y} - [x] Completed todo task${R}\n${Y} - [ ] Another open task #work${R} ${D}← tags work inside tasks${R}\n\n${C}${B} ━━━ BLOCKQUOTE ━━━${R}\n\n${Y} > Single line quote${R}\n\n${Y} > Multi-line quote${R}\n${Y} > continues with > prefix${R}\n${Y} > on each line${R}\n\n${C}${B} ━━━ DIVIDER ━━━${R}\n\n${Y} ---${R} ${D}← horizontal rule${R}\n\n${C}${B} ━━━ CODE BLOCK ━━━${R}\n\n${Y} \\`\\`\\`javascript${R}\n${Y} function greet(name) {${R}\n${Y} return \\`Hello, \\${name}!\\`;${R}\n${Y} }${R}\n${Y} \\`\\`\\`${R}\n\n${D} Languages: python, javascript, typescript, rust, go, java,${R}\n${D} c, cpp, csharp, ruby, php, swift, kotlin, sql, html, css,${R}\n${D} json, yaml, xml, markdown, bash, shell, dockerfile, graphql${R}\n\n${C}${B} ━━━ MERMAID DIAGRAM ━━━${R}\n${D} Use \\`\\`\\`mermaid to open, \\`\\`\\` to close. All Mermaid syntax works.${R}\n\n${D} Flowchart:${R}\n${Y} \\`\\`\\`mermaid${R}\n${Y} graph TD;${R}\n${Y} A[Start] --> B{Decision};${R}\n${Y} B -->|Yes| C[Do X];${R}\n${Y} B -->|No| D[Do Y];${R}\n${Y} C --> E[End];${R}\n${Y} D --> E;${R}\n${Y} \\`\\`\\`${R}\n\n${D} Sequence diagram:${R}\n${Y} \\`\\`\\`mermaid${R}\n${Y} sequenceDiagram${R}\n${Y} Client->>Server: Request${R}\n${Y} Server->>DB: Query${R}\n${Y} DB-->>Server: Result${R}\n${Y} Server-->>Client: Response${R}\n${Y} \\`\\`\\`${R}\n\n${D} ER diagram:${R}\n${Y} \\`\\`\\`mermaid${R}\n${Y} erDiagram${R}\n${Y} USER ||--o{ POST : writes${R}\n${Y} POST ||--o{ COMMENT : has${R}\n${Y} USER ||--o{ COMMENT : writes${R}\n${Y} \\`\\`\\`${R}\n\n${D} Class diagram:${R}\n${Y} \\`\\`\\`mermaid${R}\n${Y} classDiagram${R}\n${Y} class Animal {${R}\n${Y} +String name${R}\n${Y} +eat() void${R}\n${Y} }${R}\n${Y} Animal <|-- Dog${R}\n${Y} Animal <|-- Cat${R}\n${Y} \\`\\`\\`${R}\n\n${D} Also: gantt, pie, stateDiagram, flowchart, gitGraph, mindmap${R}\n\n${C}${B} ━━━ MATH (LaTeX) ━━━${R}\n\n${C} Inline math (within text):${R}\n${Y} The formula $E = mc^2$ is famous.${R}\n${Y} Solve for $x$ where $ax^2 + bx + c = 0$.${R}\n\n${C} Block math (standalone):${R}\n${D} Use $$ on its own line to open and close. KaTeX syntax.${R}\n\n${Y} $$${R}\n${Y} E = mc^2${R}\n${Y} $$${R}\n\n${Y} $$${R}\n${Y} \\\\frac{-b \\\\pm \\\\sqrt{b^2 - 4ac}}{2a}${R}\n${Y} $$${R}\n\n${Y} $$${R}\n${Y} \\\\sum_{i=1}^{n} i = \\\\frac{n(n+1)}{2}${R}\n${Y} $$${R}\n\n${Y} $$${R}\n${Y} \\\\int_0^\\\\infty e^{-x^2} dx = \\\\frac{\\\\sqrt{\\\\pi}}{2}${R}\n${Y} $$${R}\n\n${D} Common LaTeX: \\\\frac{a}{b} \\\\sqrt{x} x^{2} x_{i}${R}\n${D} \\\\sum \\\\prod \\\\int \\\\lim \\\\infty \\\\alpha \\\\beta \\\\pi${R}\n${D} \\\\text{label} \\\\mathbb{R} \\\\vec{v} \\\\hat{x} \\\\bar{x}${R}\n${D} Matrices: \\\\begin{pmatrix} a & b \\\\\\\\ c & d \\\\end{pmatrix}${R}\n\n${C}${B} ━━━ CALLOUT BLOCKS ━━━${R}\n${D} 4 variants: info, warning, error, tip${R}\n\n${Y} > [!info]${R}\n${Y} > This is an informational note.${R}\n\n${Y} > [!warning]${R}\n${Y} > Be careful about this.${R}\n\n${Y} > [!error]${R}\n${Y} > Something went wrong.${R}\n\n${Y} > [!tip]${R}\n${Y} > Helpful suggestion here.${R}\n\n${D} Multi-line callout:${R}\n${Y} > [!info]${R}\n${Y} > Line one of the callout.${R}\n${Y} > Line two continues here.${R}\n${Y} > Each line needs the > prefix.${R}\n\n${C}${B} ━━━ QUERY BLOCK (live search) ━━━${R}\n\n${Y} > [!query]${R}\n${Y} > type:todo status:open${R}\n\n${Y} > [!query]${R}\n${Y} > #work type:todo${R}\n\n${D} Queries: keyword, #tag, type:todo/code/heading, status:open/done${R}\n\n${C}${B} ━━━ INLINE LINK ━━━${R}\n\n${Y} [Link Text](https://example.com)${R}\n${D} Opens in new tab. Works in paragraphs, lists, todos, callouts.${R}\n\n${C}${B} ━━━ EMBED (link preview) ━━━${R}\n\n${Y} > [!embed]${R}\n${Y} > https://www.youtube.com/watch?v=VIDEO_ID${R}\n\n${Y} > [!embed]${R}\n${Y} > https://github.com/user/repo${R}\n${D} YouTube → embedded video player${R}\n${D} Other URLs → preview card with title, description, image${R}\n\n${C}${B} ━━━ IMAGE ━━━${R}\n\n${Y} ![alt text](https://example.com/image.png)${R}\n\n${C}${B} ━━━ FILE ATTACHMENT ━━━${R}\n\n${Y} > [!file]${R}\n${Y} > [document.pdf](https://example.com/file.pdf)${R}\n${Y} > application/pdf 149780${R}\n\n${D} Format: > [filename](url) then > mimetype size_in_bytes${R}\n\n${D} ──────────────────────────────────────────────────────────${R}\n\n${C}${B} COMMANDS${R}\n ${G}vertex new \"Title\"${R} ${D}← create empty note${R}\n ${G}vertex edit \"Title\"${R} ${D}← edit in $EDITOR${R}\n ${G}vertex import file.md${R} ${D}← import markdown as new note${R}\n ${G}vertex import file.md -t \"T\"${R} ${D}← import with custom title${R}\n ${G}vertex export \"Title\"${R} ${D}← print as markdown${R}\n ${G}vertex export \"Title\" -o out.md${R} ${D}← save to file${R}\n ${G}vertex view \"Title\"${R} ${D}← quick view (same as export)${R}\n ${G}vertex syntax${R} ${D}← this reference${R}\n\n${C}${B} AI USAGE${R}\n${D} Any AI can create Vertex notes. Write a .md file using${R}\n${D} the syntax above, then:${R}\n\n ${G}vertex import note.md -t \"My Note\"${R}\n\n${D} Or edit an existing note directly:${R}\n\n ${G}vertex edit \"My Note\"${R}\n\n${D} The note will render with rich blocks (mermaid diagrams,${R}\n${D} LaTeX math, syntax-highlighted code, callouts, etc.)${R}\n${D} in the Vertex web app at ${P}https://vertex-alu.pages.dev${R}\n\n${C}${B} FULL EXAMPLE${R}\n${D} ──────────────────────────────────────────────────────────${R}\n${Y} # Project Notes${R}\n${Y} ${R}\n${Y} Overview of the #project with [[Related Note]] link.${R}\n${Y} ${R}\n${Y} ## Architecture${R}\n${Y} ${R}\n${Y} \\`\\`\\`mermaid${R}\n${Y} graph LR;${R}\n${Y} Client --> API --> DB;${R}\n${Y} \\`\\`\\`${R}\n${Y} ${R}\n${Y} ## Key Formula${R}\n${Y} ${R}\n${Y} $$${R}\n${Y} O(n \\\\log n)${R}\n${Y} $$${R}\n${Y} ${R}\n${Y} ## Code${R}\n${Y} ${R}\n${Y} \\`\\`\\`python${R}\n${Y} print(\"hello\")${R}\n${Y} \\`\\`\\`${R}\n${Y} ${R}\n${Y} > [!tip]${R}\n${Y} > Remember to test edge cases.${R}\n${Y} ${R}\n${Y} ## Tasks${R}\n${Y} ${R}\n${Y} - [x] Design complete${R}\n${Y} - [ ] Implementation pending #work${R}\n${D} ──────────────────────────────────────────────────────────${R}\n`);\n }\n}\n"],"mappings":";AAAA,SAAS,eAAe;AAExB,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AACV,IAAM,IAAI;AAEV,IAAqB,SAArB,cAAoC,QAAQ;AAAA,EAC1C,OAAgB,cAAc;AAAA,EAE9B,MAAM,MAAqB;AACzB,SAAK,IAAI;AAAA,EACX,CAAC,GAAG,CAAC,qDAAgD,CAAC;AAAA,EACtD,CAAC,qEAAqE,CAAC;AAAA,EACvE,CAAC,iWAA+D,CAAC;AAAA;AAAA,EAEjE,CAAC,GAAG,CAAC,UAAU,CAAC;AAAA,EAChB,CAAC,wDAAmD,CAAC;AAAA,EACrD,CAAC,8DAAyD,CAAC;AAAA,EAC3D,CAAC,8DAAyD,CAAC;AAAA,EAC3D,CAAC,0EAAqE,CAAC;AAAA,EACvE,CAAC,wCAAmC,CAAC;AAAA;AAAA,EAErC,CAAC,GAAG,CAAC,0DAA4B,CAAC;AAAA;AAAA,EAElC,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,oBAAe,CAAC;AAAA,EAC5D,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,iBAAY,CAAC;AAAA,EACzD,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,oBAAe,CAAC;AAAA,EAC5D,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,uBAAkB,CAAC;AAAA;AAAA,EAE/D,CAAC,0BAA0B,CAAC,eAAe,CAAC,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EACP,CAAC,mBAAmB,CAAC;AAAA,EACrB,CAAC,KAAK,CAAC;AAAA,EACP,CAAC,OAAO,CAAC;AAAA,EACT,CAAC,iBAAiB,CAAC;AAAA,EACnB,CAAC,OAAO,CAAC;AAAA,EACT,CAAC,KAAK,CAAC;AAAA,EACP,CAAC,YAAY,CAAC;AAAA,EACd,CAAC,KAAK,CAAC;AAAA,EACP,CAAC,iBAAiB,CAAC;AAAA,EACnB,CAAC,mBAAmB,CAAC;AAAA,EACrB,CAAC,WAAW,CAAC;AAAA,EACb,CAAC,KAAK,CAAC;AAAA,EACP,CAAC,aAAa,CAAC;AAAA,EACf,CAAC,mCAAmC,CAAC;AAAA,EACrC,CAAC,KAAK,CAAC;AAAA,EACP,CAAC,aAAa,CAAC;AAAA,EACf,CAAC,KAAK,CAAC;AAAA,EACP,CAAC,0BAA0B,CAAC;AAAA,EAC5B,CAAC,uCAAuC,CAAC;AAAA,EACzC,CAAC,iWAA+D,CAAC;AAAA,CAClE;AAAA,EACC;AACF;","names":[]}
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getClient,
3
3
  getUserId
4
- } from "../chunk-DDFOKGIX.js";
4
+ } from "../chunk-URRSVCB7.js";
5
5
  import "../chunk-PBF5EE4Y.js";
6
6
  import {
7
7
  getUserTags
8
- } from "../chunk-4QLCD6TZ.js";
8
+ } from "../chunk-EEEL6ZKK.js";
9
9
 
10
10
  // src/commands/tags.ts
11
11
  import { Command } from "@oclif/core";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getClient,
3
3
  getUserId
4
- } from "../chunk-DDFOKGIX.js";
4
+ } from "../chunk-URRSVCB7.js";
5
5
  import "../chunk-PBF5EE4Y.js";
6
6
  import {
7
7
  listNotes
8
- } from "../chunk-4QLCD6TZ.js";
8
+ } from "../chunk-EEEL6ZKK.js";
9
9
 
10
10
  // src/commands/today.ts
11
11
  import { Command } from "@oclif/core";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getClient,
3
3
  getUserId
4
- } from "../../chunk-DDFOKGIX.js";
4
+ } from "../../chunk-URRSVCB7.js";
5
5
  import "../../chunk-PBF5EE4Y.js";
6
6
  import {
7
7
  emptyTrash
8
- } from "../../chunk-4QLCD6TZ.js";
8
+ } from "../../chunk-EEEL6ZKK.js";
9
9
 
10
10
  // src/commands/trash/empty.ts
11
11
  import { Command } from "@oclif/core";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getClient,
3
3
  getUserId
4
- } from "../../chunk-DDFOKGIX.js";
4
+ } from "../../chunk-URRSVCB7.js";
5
5
  import "../../chunk-PBF5EE4Y.js";
6
6
  import {
7
7
  listNotes
8
- } from "../../chunk-4QLCD6TZ.js";
8
+ } from "../../chunk-EEEL6ZKK.js";
9
9
 
10
10
  // src/commands/trash/index.ts
11
11
  import { Command } from "@oclif/core";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  getClient,
3
3
  getUserId
4
- } from "../chunk-DDFOKGIX.js";
4
+ } from "../chunk-URRSVCB7.js";
5
5
  import "../chunk-PBF5EE4Y.js";
6
6
  import {
7
7
  exportNoteAsMarkdown,
8
8
  listNotes
9
- } from "../chunk-4QLCD6TZ.js";
9
+ } from "../chunk-EEEL6ZKK.js";
10
10
 
11
11
  // src/commands/view.ts
12
12
  import { Command, Args } from "@oclif/core";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getClient,
3
3
  getUserId
4
- } from "../chunk-DDFOKGIX.js";
4
+ } from "../chunk-URRSVCB7.js";
5
5
  import "../chunk-PBF5EE4Y.js";
6
- import "../chunk-4QLCD6TZ.js";
6
+ import "../chunk-EEEL6ZKK.js";
7
7
  export {
8
8
  getClient,
9
9
  getUserId
@@ -1,6 +1,248 @@
1
- import {
2
- markdownToTiptap
3
- } from "../chunk-FWK2J3FR.js";
1
+ // src/lib/md-to-tiptap.ts
2
+ function markdownToTiptap(md) {
3
+ const lines = md.split("\n");
4
+ const nodes = [];
5
+ let i = 0;
6
+ while (i < lines.length) {
7
+ const line = lines[i];
8
+ if (line.match(/^#{1,4}\s/)) {
9
+ const match = line.match(/^(#{1,4})\s(.*)$/);
10
+ if (match) {
11
+ nodes.push({
12
+ type: "heading",
13
+ attrs: { level: match[1].length },
14
+ content: parseInline(match[2])
15
+ });
16
+ }
17
+ i++;
18
+ continue;
19
+ }
20
+ if (line.match(/^```mermaid\s*$/)) {
21
+ const mermaidLines = [];
22
+ i++;
23
+ while (i < lines.length && !lines[i].match(/^```\s*$/)) {
24
+ mermaidLines.push(lines[i]);
25
+ i++;
26
+ }
27
+ i++;
28
+ nodes.push({
29
+ type: "mermaidBlock",
30
+ content: [{ type: "text", text: mermaidLines.join("\n") }]
31
+ });
32
+ continue;
33
+ }
34
+ if (line.match(/^```/)) {
35
+ const langMatch = line.match(/^```(\w*)$/);
36
+ const language = langMatch?.[1] || "plaintext";
37
+ const codeLines = [];
38
+ i++;
39
+ while (i < lines.length && !lines[i].match(/^```\s*$/)) {
40
+ codeLines.push(lines[i]);
41
+ i++;
42
+ }
43
+ i++;
44
+ nodes.push({
45
+ type: "codeBlock",
46
+ attrs: { language },
47
+ content: [{ type: "text", text: codeLines.join("\n") }]
48
+ });
49
+ continue;
50
+ }
51
+ if (line.match(/^\$\$\s*$/)) {
52
+ const mathLines = [];
53
+ i++;
54
+ while (i < lines.length && !lines[i].match(/^\$\$\s*$/)) {
55
+ mathLines.push(lines[i]);
56
+ i++;
57
+ }
58
+ i++;
59
+ nodes.push({
60
+ type: "mathBlock",
61
+ content: [{ type: "text", text: mathLines.join("\n") }]
62
+ });
63
+ continue;
64
+ }
65
+ if (line.match(/^>\s*\[!(\w+)\]\s*$/)) {
66
+ const variantMatch = line.match(/^>\s*\[!(\w+)\]\s*$/);
67
+ const variant = variantMatch?.[1] ?? "info";
68
+ if (variant === "query") {
69
+ const queryLines = [];
70
+ i++;
71
+ while (i < lines.length && lines[i].match(/^>\s/)) {
72
+ queryLines.push(lines[i].replace(/^>\s?/, ""));
73
+ i++;
74
+ }
75
+ nodes.push({
76
+ type: "queryBlock",
77
+ content: [{ type: "text", text: queryLines.join("\n") }]
78
+ });
79
+ continue;
80
+ }
81
+ if (variant === "embed") {
82
+ i++;
83
+ const embedUrl = lines[i]?.replace(/^>\s?/, "").trim() ?? "";
84
+ i++;
85
+ nodes.push({
86
+ type: "linkPreview",
87
+ attrs: { url: embedUrl }
88
+ });
89
+ continue;
90
+ }
91
+ if (variant === "file") {
92
+ i++;
93
+ const linkLine = lines[i]?.replace(/^>\s?/, "") ?? "";
94
+ const linkMatch = linkLine.match(/^\[(.+?)\]\((.+?)\)$/);
95
+ i++;
96
+ const metaLine = lines[i]?.replace(/^>\s?/, "") ?? "";
97
+ const metaParts = metaLine.split(" ");
98
+ i++;
99
+ nodes.push({
100
+ type: "fileBlock",
101
+ attrs: {
102
+ filename: linkMatch?.[1] ?? "file",
103
+ src: linkMatch?.[2] ?? "",
104
+ filetype: metaParts[0] ?? "",
105
+ filesize: parseInt(metaParts[1] ?? "0", 10) || 0
106
+ }
107
+ });
108
+ continue;
109
+ }
110
+ const calloutLines = [];
111
+ i++;
112
+ while (i < lines.length && lines[i].match(/^>\s/)) {
113
+ calloutLines.push(lines[i].replace(/^>\s?/, ""));
114
+ i++;
115
+ }
116
+ nodes.push({
117
+ type: "calloutBlock",
118
+ attrs: { variant },
119
+ content: [{ type: "paragraph", content: parseInline(calloutLines.join("\n")) }]
120
+ });
121
+ continue;
122
+ }
123
+ if (line.match(/^>\s/)) {
124
+ const quoteLines = [];
125
+ while (i < lines.length && lines[i].match(/^>\s?/)) {
126
+ quoteLines.push(lines[i].replace(/^>\s?/, ""));
127
+ i++;
128
+ }
129
+ nodes.push({
130
+ type: "blockquote",
131
+ content: [{ type: "paragraph", content: parseInline(quoteLines.join("\n")) }]
132
+ });
133
+ continue;
134
+ }
135
+ if (line.match(/^---\s*$/)) {
136
+ nodes.push({ type: "horizontalRule" });
137
+ i++;
138
+ continue;
139
+ }
140
+ if (line.match(/^!\[.*?\]\(.*?\)$/)) {
141
+ const imgMatch = line.match(/^!\[(.*?)\]\((.*?)\)$/);
142
+ if (imgMatch) {
143
+ nodes.push({
144
+ type: "image",
145
+ attrs: { src: imgMatch[2], alt: imgMatch[1] }
146
+ });
147
+ }
148
+ i++;
149
+ continue;
150
+ }
151
+ if (line.match(/^[-*]\s\[[ x]\]\s/)) {
152
+ const taskItems = [];
153
+ while (i < lines.length && lines[i].match(/^[-*]\s\[[ x]\]\s/)) {
154
+ const m = lines[i].match(/^[-*]\s\[([ x])\]\s(.*)$/);
155
+ if (m) {
156
+ taskItems.push({
157
+ type: "taskItem",
158
+ attrs: { checked: m[1] === "x" },
159
+ content: [{ type: "paragraph", content: parseInline(m[2]) }]
160
+ });
161
+ }
162
+ i++;
163
+ }
164
+ nodes.push({ type: "taskList", content: taskItems });
165
+ continue;
166
+ }
167
+ if (line.match(/^[-*]\s/)) {
168
+ const items = [];
169
+ while (i < lines.length && lines[i].match(/^[-*]\s/)) {
170
+ const text = lines[i].replace(/^[-*]\s/, "");
171
+ items.push({
172
+ type: "listItem",
173
+ content: [{ type: "paragraph", content: parseInline(text) }]
174
+ });
175
+ i++;
176
+ }
177
+ nodes.push({ type: "bulletList", content: items });
178
+ continue;
179
+ }
180
+ if (line.match(/^\d+\.\s/)) {
181
+ const items = [];
182
+ while (i < lines.length && lines[i].match(/^\d+\.\s/)) {
183
+ const text = lines[i].replace(/^\d+\.\s/, "");
184
+ items.push({
185
+ type: "listItem",
186
+ content: [{ type: "paragraph", content: parseInline(text) }]
187
+ });
188
+ i++;
189
+ }
190
+ nodes.push({ type: "orderedList", content: items });
191
+ continue;
192
+ }
193
+ if (line.trim() === "") {
194
+ i++;
195
+ continue;
196
+ }
197
+ const paraLines = [];
198
+ while (i < lines.length && lines[i].trim() !== "" && !lines[i].match(/^#{1,4}\s/) && !lines[i].match(/^```/) && !lines[i].match(/^\$\$/) && !lines[i].match(/^---\s*$/) && !lines[i].match(/^[-*]\s/) && !lines[i].match(/^\d+\.\s/) && !lines[i].match(/^>\s/) && !lines[i].match(/^!\[/)) {
199
+ paraLines.push(lines[i]);
200
+ i++;
201
+ }
202
+ nodes.push({
203
+ type: "paragraph",
204
+ content: parseInline(paraLines.join("\n"))
205
+ });
206
+ }
207
+ if (nodes.length === 0) {
208
+ nodes.push({ type: "paragraph" });
209
+ }
210
+ return { type: "doc", content: nodes };
211
+ }
212
+ function parseInline(text) {
213
+ if (!text) return [];
214
+ const nodes = [];
215
+ const regex = /(\*\*([^*]+)\*\*|\*([^*]+)\*|`([^`]+)`|~~([^~]+)~~|\[\[([^\]]+)\]\]|#([a-zA-Z][a-zA-Z0-9_/-]*)|\[([^\]]+)\]\(([^)]+)\)|(?<!\$)\$([^\$\n]+)\$(?!\$))/g;
216
+ let lastIndex = 0;
217
+ let match;
218
+ while ((match = regex.exec(text)) !== null) {
219
+ if (match.index > lastIndex) {
220
+ nodes.push({ type: "text", text: text.slice(lastIndex, match.index) });
221
+ }
222
+ if (match[2]) {
223
+ nodes.push({ type: "text", text: match[2], marks: [{ type: "bold" }] });
224
+ } else if (match[3]) {
225
+ nodes.push({ type: "text", text: match[3], marks: [{ type: "italic" }] });
226
+ } else if (match[4]) {
227
+ nodes.push({ type: "text", text: match[4], marks: [{ type: "code" }] });
228
+ } else if (match[5]) {
229
+ nodes.push({ type: "text", text: match[5], marks: [{ type: "strike" }] });
230
+ } else if (match[6]) {
231
+ nodes.push({ type: "text", text: `[[${match[6]}]]` });
232
+ } else if (match[7]) {
233
+ nodes.push({ type: "text", text: `#${match[7]}` });
234
+ } else if (match[8] && match[9]) {
235
+ nodes.push({ type: "text", text: match[8], marks: [{ type: "link", attrs: { href: match[9], target: "_blank" } }] });
236
+ } else if (match[10]) {
237
+ nodes.push({ type: "inlineMath", attrs: { formula: match[10] } });
238
+ }
239
+ lastIndex = match.index + match[0].length;
240
+ }
241
+ if (lastIndex < text.length) {
242
+ nodes.push({ type: "text", text: text.slice(lastIndex) });
243
+ }
244
+ return nodes.length > 0 ? nodes : [{ type: "text", text: text || " " }];
245
+ }
4
246
  export {
5
247
  markdownToTiptap
6
248
  };