obsidian-dev-skills 1.0.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,759 @@
1
+ <!--
2
+ Source: Based on obsidian-skills (https://github.com/kepano/obsidian-skills) and Obsidian documentation
3
+ Last synced: See sync-status.json for authoritative sync dates
4
+ Update frequency: Check obsidian-skills and Obsidian documentation for updates
5
+ Applicability: Both (Plugin/Theme)
6
+ -->
7
+
8
+ # Obsidian File Formats and Syntax
9
+
10
+ This guide provides comprehensive information about Obsidian file formats and syntax for AI agents working on Obsidian plugins and themes. This is essential knowledge for plugins that manipulate vault files, parse Markdown, or work with Obsidian-specific formats.
11
+
12
+ ## Overview
13
+
14
+ Obsidian supports several file formats:
15
+ - **Markdown** (`.md`) - Obsidian Flavored Markdown with extensions
16
+ - **Bases** (`.base`) - YAML-based database views
17
+ - **Canvas** (`.canvas`) - JSON Canvas format for visual canvases
18
+
19
+ ## Obsidian Flavored Markdown
20
+
21
+ Obsidian uses a combination of Markdown flavors:
22
+ - [CommonMark](https://commonmark.org/)
23
+ - [GitHub Flavored Markdown](https://github.github.com/gfm/)
24
+ - [LaTeX](https://www.latex-project.org/) for math
25
+ - Obsidian-specific extensions (wikilinks, callouts, embeds, properties, etc.)
26
+
27
+ ### Basic Formatting
28
+
29
+ #### Paragraphs and Line Breaks
30
+
31
+ ```markdown
32
+ This is a paragraph.
33
+
34
+ This is another paragraph (blank line between creates separate paragraphs).
35
+
36
+ For a line break within a paragraph, add two spaces at the end
37
+ or use Shift+Enter.
38
+ ```
39
+
40
+ #### Headings
41
+
42
+ ```markdown
43
+ # Heading 1
44
+ ## Heading 2
45
+ ### Heading 3
46
+ #### Heading 4
47
+ ##### Heading 5
48
+ ###### Heading 6
49
+ ```
50
+
51
+ #### Text Formatting
52
+
53
+ | Style | Syntax | Example | Output |
54
+ |-------|--------|---------|--------|
55
+ | Bold | `**text**` or `__text__` | `**Bold**` | **Bold** |
56
+ | Italic | `*text*` or `_text_` | `*Italic*` | *Italic* |
57
+ | Bold + Italic | `***text***` | `***Both***` | ***Both*** |
58
+ | Strikethrough | `~~text~~` | `~~Striked~~` | ~~Striked~~ |
59
+ | Highlight | `==text==` | `==Highlighted==` | ==Highlighted== |
60
+ | Inline code | `` `code` `` | `` `code` `` | `code` |
61
+
62
+ #### Escaping Formatting
63
+
64
+ Use backslash to escape special characters:
65
+ ```markdown
66
+ \*This won't be italic\*
67
+ \#This won't be a heading
68
+ 1\. This won't be a list item
69
+ ```
70
+
71
+ Common characters to escape: `\*`, `\_`, `\#`, `` \` ``, `\|`, `\~`
72
+
73
+ ### Internal Links (Wikilinks)
74
+
75
+ Wikilinks are Obsidian's primary linking mechanism.
76
+
77
+ #### Basic Links
78
+
79
+ ```markdown
80
+ [[Note Name]]
81
+ [[Note Name.md]]
82
+ [[Note Name|Display Text]]
83
+ ```
84
+
85
+ #### Link to Headings
86
+
87
+ ```markdown
88
+ [[Note Name#Heading]]
89
+ [[Note Name#Heading|Custom Text]]
90
+ [[#Heading in same note]]
91
+ [[##Search all headings in vault]]
92
+ ```
93
+
94
+ #### Link to Blocks
95
+
96
+ ```markdown
97
+ [[Note Name#^block-id]]
98
+ [[Note Name#^block-id|Custom Text]]
99
+ ```
100
+
101
+ Define a block ID by adding `^block-id` at the end of a paragraph:
102
+ ```markdown
103
+ This is a paragraph that can be linked to. ^my-block-id
104
+ ```
105
+
106
+ For lists and quotes, add the block ID on a separate line:
107
+ ```markdown
108
+ > This is a quote
109
+ > With multiple lines
110
+
111
+ ^quote-id
112
+ ```
113
+
114
+ #### Search Links
115
+
116
+ ```markdown
117
+ [[##heading]] Search for headings containing "heading"
118
+ [[^^block]] Search for blocks containing "block"
119
+ ```
120
+
121
+ ### Markdown-Style Links
122
+
123
+ ```markdown
124
+ [Display Text](Note%20Name.md)
125
+ [Display Text](Note%20Name.md#Heading)
126
+ [Display Text](https://example.com)
127
+ [Note](obsidian://open?vault=VaultName&file=Note.md)
128
+ ```
129
+
130
+ **Note**: Spaces must be URL-encoded as `%20` in Markdown links.
131
+
132
+ ### Embeds
133
+
134
+ #### Embed Notes
135
+
136
+ ```markdown
137
+ ![[Note Name]]
138
+ ![[Note Name#Heading]]
139
+ ![[Note Name#^block-id]]
140
+ ```
141
+
142
+ #### Embed Images
143
+
144
+ ```markdown
145
+ ![[image.png]]
146
+ ![[image.png|640x480]] Width x Height
147
+ ![[image.png|300]] Width only (maintains aspect ratio)
148
+ ```
149
+
150
+ #### External Images
151
+
152
+ ```markdown
153
+ ![Alt text](https://example.com/image.png)
154
+ ![Alt text|300](https://example.com/image.png)
155
+ ```
156
+
157
+ #### Embed Audio
158
+
159
+ ```markdown
160
+ ![[audio.mp3]]
161
+ ![[audio.ogg]]
162
+ ```
163
+
164
+ #### Embed PDF
165
+
166
+ ```markdown
167
+ ![[document.pdf]]
168
+ ![[document.pdf#page=3]]
169
+ ![[document.pdf#height=400]]
170
+ ```
171
+
172
+ #### Embed Lists
173
+
174
+ ```markdown
175
+ ![[Note#^list-id]]
176
+ ```
177
+
178
+ Where the list has been defined with a block ID:
179
+ ```markdown
180
+ - Item 1
181
+ - Item 2
182
+ - Item 3
183
+
184
+ ^list-id
185
+ ```
186
+
187
+ #### Embed Search Results
188
+
189
+ ````markdown
190
+ ```query
191
+ tag:#project status:done
192
+ ```
193
+ ````
194
+
195
+ ### Callouts
196
+
197
+ #### Basic Callout
198
+
199
+ ```markdown
200
+ > [!note]
201
+ > This is a note callout.
202
+
203
+ > [!info] Custom Title
204
+ > This callout has a custom title.
205
+
206
+ > [!tip] Title Only
207
+ ```
208
+
209
+ #### Foldable Callouts
210
+
211
+ ```markdown
212
+ > [!faq]- Collapsed by default
213
+ > This content is hidden until expanded.
214
+
215
+ > [!faq]+ Expanded by default
216
+ > This content is visible but can be collapsed.
217
+ ```
218
+
219
+ #### Nested Callouts
220
+
221
+ ```markdown
222
+ > [!question] Outer callout
223
+ > > [!note] Inner callout
224
+ > > Nested content
225
+ ```
226
+
227
+ #### Supported Callout Types
228
+
229
+ | Type | Aliases | Description |
230
+ |------|---------|-------------|
231
+ | `note` | - | Blue, pencil icon |
232
+ | `abstract` | `summary`, `tldr` | Teal, clipboard icon |
233
+ | `info` | - | Blue, info icon |
234
+ | `todo` | - | Blue, checkbox icon |
235
+ | `tip` | `hint`, `important` | Cyan, flame icon |
236
+ | `success` | `check`, `done` | Green, checkmark icon |
237
+ | `question` | `help`, `faq` | Yellow, question mark |
238
+ | `warning` | `caution`, `attention` | Orange, warning icon |
239
+ | `failure` | `fail`, `missing` | Red, X icon |
240
+ | `danger` | `error` | Red, zap icon |
241
+ | `bug` | - | Red, bug icon |
242
+ | `example` | - | Purple, list icon |
243
+ | `quote` | `cite` | Gray, quote icon |
244
+
245
+ ### Lists
246
+
247
+ #### Unordered Lists
248
+
249
+ ```markdown
250
+ - Item 1
251
+ - Item 2
252
+ - Nested item
253
+ - Another nested
254
+ - Item 3
255
+
256
+ * Also works with asterisks
257
+ + Or plus signs
258
+ ```
259
+
260
+ #### Ordered Lists
261
+
262
+ ```markdown
263
+ 1. First item
264
+ 2. Second item
265
+ 1. Nested numbered
266
+ 2. Another nested
267
+ 3. Third item
268
+
269
+ 1) Alternative syntax
270
+ 2) With parentheses
271
+ ```
272
+
273
+ #### Task Lists
274
+
275
+ ```markdown
276
+ - [ ] Incomplete task
277
+ - [x] Completed task
278
+ - [ ] Task with sub-tasks
279
+ - [ ] Subtask 1
280
+ - [x] Subtask 2
281
+ ```
282
+
283
+ ### Quotes
284
+
285
+ ```markdown
286
+ > This is a blockquote.
287
+ > It can span multiple lines.
288
+ >
289
+ > And include multiple paragraphs.
290
+ >
291
+ > > Nested quotes work too.
292
+ ```
293
+
294
+ ### Code
295
+
296
+ #### Inline Code
297
+
298
+ ```markdown
299
+ Use `backticks` for inline code.
300
+ Use double backticks for ``code with a ` backtick inside``.
301
+ ```
302
+
303
+ #### Code Blocks
304
+
305
+ ````markdown
306
+ ```
307
+ Plain code block
308
+ ```
309
+
310
+ ```javascript
311
+ // Syntax highlighted code block
312
+ function hello() {
313
+ console.log("Hello, world!");
314
+ }
315
+ ```
316
+
317
+ ```python
318
+ # Python example
319
+ def greet(name):
320
+ print(f"Hello, {name}!")
321
+ ```
322
+ ````
323
+
324
+ #### Nesting Code Blocks
325
+
326
+ Use more backticks or tildes for the outer block:
327
+
328
+ `````markdown
329
+ ````markdown
330
+ Here's how to create a code block:
331
+ ```js
332
+ console.log("Hello")
333
+ ```
334
+ ````
335
+ `````
336
+
337
+ ### Tables
338
+
339
+ ```markdown
340
+ | Header 1 | Header 2 | Header 3 |
341
+ |----------|----------|----------|
342
+ | Cell 1 | Cell 2 | Cell 3 |
343
+ | Cell 4 | Cell 5 | Cell 6 |
344
+ ```
345
+
346
+ #### Alignment
347
+
348
+ ```markdown
349
+ | Left | Center | Right |
350
+ |:---------|:--------:|---------:|
351
+ | Left | Center | Right |
352
+ ```
353
+
354
+ #### Using Pipes in Tables
355
+
356
+ Escape pipes with backslash:
357
+ ```markdown
358
+ | Column 1 | Column 2 |
359
+ |----------|----------|
360
+ | [[Link\|Display]] | ![[Image\|100]] |
361
+ ```
362
+
363
+ ### Math (LaTeX)
364
+
365
+ #### Inline Math
366
+
367
+ ```markdown
368
+ This is inline math: $e^{i\pi} + 1 = 0$
369
+ ```
370
+
371
+ #### Block Math
372
+
373
+ ```markdown
374
+ $$
375
+ \begin{vmatrix}
376
+ a & b \\
377
+ c & d
378
+ \end{vmatrix} = ad - bc
379
+ $$
380
+ ```
381
+
382
+ #### Common Math Syntax
383
+
384
+ ```markdown
385
+ $x^2$ Superscript
386
+ $x_i$ Subscript
387
+ $\frac{a}{b}$ Fraction
388
+ $\sqrt{x}$ Square root
389
+ $\sum_{i=1}^{n}$ Summation
390
+ $\int_a^b$ Integral
391
+ $\alpha, \beta$ Greek letters
392
+ ```
393
+
394
+ ### Diagrams (Mermaid)
395
+
396
+ ````markdown
397
+ ```mermaid
398
+ graph TD
399
+ A[Start] --> B{Decision}
400
+ B -->|Yes| C[Do this]
401
+ B -->|No| D[Do that]
402
+ C --> E[End]
403
+ D --> E
404
+ ```
405
+ ````
406
+
407
+ #### Sequence Diagrams
408
+
409
+ ````markdown
410
+ ```mermaid
411
+ sequenceDiagram
412
+ Alice->>Bob: Hello Bob
413
+ Bob-->>Alice: Hi Alice
414
+ ```
415
+ ````
416
+
417
+ ### Footnotes
418
+
419
+ ```markdown
420
+ This sentence has a footnote[^1].
421
+
422
+ [^1]: This is the footnote content.
423
+
424
+ You can also use named footnotes[^note].
425
+
426
+ [^note]: Named footnotes still appear as numbers.
427
+
428
+ Inline footnotes are also supported.^[This is an inline footnote.]
429
+ ```
430
+
431
+ ### Comments
432
+
433
+ ```markdown
434
+ This is visible %%but this is hidden%% text.
435
+
436
+ %%
437
+ This entire block is hidden.
438
+ It won't appear in reading view.
439
+ %%
440
+ ```
441
+
442
+ ### Horizontal Rules
443
+
444
+ ```markdown
445
+ ---
446
+ ***
447
+ ___
448
+ - - -
449
+ * * *
450
+ ```
451
+
452
+ ### Properties (YAML metadata)
453
+
454
+ **Important**: Obsidian uses the term "properties" (not "frontmatter" or "front-matter") when referring to YAML metadata at the top of Markdown files. All documentation, code comments, and UI text should use "properties" to align with Obsidian's official terminology.
455
+
456
+ Properties use YAML metadata (properties) at the start of a note:
457
+
458
+ ```yaml
459
+ ---
460
+ title: My Note Title
461
+ date: 2024-01-15
462
+ tags:
463
+ - project
464
+ - important
465
+ aliases:
466
+ - My Note
467
+ - Alternative Name
468
+ cssclasses:
469
+ - custom-class
470
+ status: in-progress
471
+ rating: 4.5
472
+ completed: false
473
+ due: 2024-02-01T14:30:00
474
+ ---
475
+ ```
476
+
477
+ #### Property Types
478
+
479
+ | Type | Example |
480
+ |------|---------|
481
+ | Text | `title: My Title` |
482
+ | Number | `rating: 4.5` |
483
+ | Checkbox | `completed: true` |
484
+ | Date | `date: 2024-01-15` |
485
+ | Date & Time | `due: 2024-01-15T14:30:00` |
486
+ | List | `tags: [one, two]` or YAML list |
487
+ | Links | `related: "[[Other Note]]"` |
488
+
489
+ #### Default Properties
490
+
491
+ - `tags` - Note tags
492
+ - `aliases` - Alternative names for the note
493
+ - `cssclasses` - CSS classes applied to the note
494
+
495
+ ### Tags
496
+
497
+ ```markdown
498
+ #tag
499
+ #nested/tag
500
+ #tag-with-dashes
501
+ #tag_with_underscores
502
+
503
+ In properties:
504
+ ---
505
+ tags:
506
+ - tag1
507
+ - nested/tag2
508
+ ---
509
+ ```
510
+
511
+ Tags can contain:
512
+ - Letters (any language)
513
+ - Numbers (not as first character)
514
+ - Underscores `_`
515
+ - Hyphens `-`
516
+ - Forward slashes `/` (for nesting)
517
+
518
+ ### HTML Content
519
+
520
+ Obsidian supports HTML within Markdown:
521
+
522
+ ```markdown
523
+ <div class="custom-container">
524
+ <span style="color: red;">Colored text</span>
525
+ </div>
526
+
527
+ <details>
528
+ <summary>Click to expand</summary>
529
+ Hidden content here.
530
+ </details>
531
+
532
+ <kbd>Ctrl</kbd> + <kbd>C</kbd>
533
+ ```
534
+
535
+ ## Obsidian Bases (.base files)
536
+
537
+ Obsidian Bases are YAML-based files that define dynamic views of notes in an Obsidian vault. A Base file can contain multiple views, global filters, formulas, property configurations, and custom summaries.
538
+
539
+ ### File Format
540
+
541
+ Base files use the `.base` extension and contain valid YAML. They can also be embedded in Markdown code blocks.
542
+
543
+ ### Complete Schema
544
+
545
+ ```yaml
546
+ # Global filters apply to ALL views in the base
547
+ filters:
548
+ # Can be a single filter string
549
+ # OR a recursive filter object with and/or/not
550
+ and: []
551
+ or: []
552
+ not: []
553
+
554
+ # Define formula properties that can be used across all views
555
+ formulas:
556
+ formula_name: 'expression'
557
+
558
+ # Configure display names and settings for properties
559
+ properties:
560
+ property_name:
561
+ displayName: "Display Name"
562
+ formula.formula_name:
563
+ displayName: "Formula Display Name"
564
+ file.ext:
565
+ displayName: "Extension"
566
+
567
+ # Define custom summary formulas
568
+ summaries:
569
+ custom_summary_name: 'values.mean().round(3)'
570
+
571
+ # Define one or more views
572
+ views:
573
+ - type: table | cards | list | map
574
+ name: "View Name"
575
+ limit: 10 # Optional: limit results
576
+ groupBy: # Optional: group results
577
+ property: property_name
578
+ direction: ASC | DESC
579
+ filters: # View-specific filters
580
+ and: []
581
+ order: # Properties to display in order
582
+ - file.name
583
+ - property_name
584
+ - formula.formula_name
585
+ summaries: # Map properties to summary formulas
586
+ property_name: Average
587
+ ```
588
+
589
+ ### Filter Syntax
590
+
591
+ Filters narrow down results. They can be applied globally or per-view.
592
+
593
+ #### Filter Structure
594
+
595
+ ```yaml
596
+ # Single filter
597
+ filters: 'status == "done"'
598
+
599
+ # AND - all conditions must be true
600
+ filters:
601
+ and:
602
+ - 'status == "done"'
603
+ - 'priority > 3'
604
+
605
+ # OR - any condition can be true
606
+ filters:
607
+ or:
608
+ - 'file.hasTag("book")'
609
+ - 'file.hasTag("article")'
610
+
611
+ # NOT - exclude matching items
612
+ filters:
613
+ not:
614
+ - 'file.hasTag("archived")'
615
+
616
+ # Nested filters
617
+ filters:
618
+ or:
619
+ - file.hasTag("tag")
620
+ - and:
621
+ - file.hasTag("book")
622
+ - file.hasLink("Textbook")
623
+ - not:
624
+ - file.hasTag("book")
625
+ - file.inFolder("Required Reading")
626
+ ```
627
+
628
+ ## JSON Canvas (.canvas files)
629
+
630
+ JSON Canvas is an open file format for infinite canvas data. Canvas files use the `.canvas` extension and contain valid JSON following the [JSON Canvas Spec 1.0](https://jsoncanvas.org/spec/1.0/).
631
+
632
+ ### File Structure
633
+
634
+ A canvas file contains two top-level arrays:
635
+
636
+ ```json
637
+ {
638
+ "nodes": [],
639
+ "edges": []
640
+ }
641
+ ```
642
+
643
+ - `nodes` (optional): Array of node objects
644
+ - `edges` (optional): Array of edge objects connecting nodes
645
+
646
+ ### Nodes
647
+
648
+ Nodes are objects placed on the canvas. There are four node types:
649
+ - `text` - Text content with Markdown
650
+ - `file` - Reference to files/attachments
651
+ - `link` - External URL
652
+ - `group` - Visual container for other nodes
653
+
654
+ #### Z-Index Ordering
655
+
656
+ Nodes are ordered by z-index in the array:
657
+ - First node = bottom layer (displayed below others)
658
+ - Last node = top layer (displayed above others)
659
+
660
+ #### Generic Node Attributes
661
+
662
+ All nodes share these attributes:
663
+
664
+ | Attribute | Required | Type | Description |
665
+ |-----------|----------|------|-------------|
666
+ | `id` | Yes | string | Unique identifier for the node |
667
+ | `type` | Yes | string | Node type: `text`, `file`, `link`, or `group` |
668
+ | `x` | Yes | integer | X position in pixels |
669
+ | `y` | Yes | integer | Y position in pixels |
670
+ | `width` | Yes | integer | Width in pixels |
671
+ | `height` | Yes | integer | Height in pixels |
672
+ | `color` | No | canvasColor | Node color (see Color section) |
673
+
674
+ #### Text Nodes
675
+
676
+ Text nodes contain Markdown content.
677
+
678
+ ```json
679
+ {
680
+ "id": "6f0ad84f44ce9c17",
681
+ "type": "text",
682
+ "x": 0,
683
+ "y": 0,
684
+ "width": 400,
685
+ "height": 200,
686
+ "text": "# Hello World\n\nThis is **Markdown** content."
687
+ }
688
+ ```
689
+
690
+ #### File Nodes
691
+
692
+ File nodes reference files or attachments (images, videos, PDFs, notes, etc.).
693
+
694
+ ```json
695
+ {
696
+ "id": "a1b2c3d4e5f67890",
697
+ "type": "file",
698
+ "x": 500,
699
+ "y": 0,
700
+ "width": 400,
701
+ "height": 300,
702
+ "file": "Attachments/diagram.png"
703
+ }
704
+ ```
705
+
706
+ #### Link Nodes
707
+
708
+ Link nodes reference external URLs.
709
+
710
+ ```json
711
+ {
712
+ "id": "b2c3d4e5f6789012",
713
+ "type": "link",
714
+ "x": 500,
715
+ "y": 400,
716
+ "width": 400,
717
+ "height": 100,
718
+ "url": "https://example.com"
719
+ }
720
+ ```
721
+
722
+ #### Group Nodes
723
+
724
+ Group nodes are visual containers for other nodes.
725
+
726
+ ```json
727
+ {
728
+ "id": "c3d4e5f678901234",
729
+ "type": "group",
730
+ "x": 0,
731
+ "y": 0,
732
+ "width": 800,
733
+ "height": 600,
734
+ "label": "My Group"
735
+ }
736
+ ```
737
+
738
+ ### Edges
739
+
740
+ Edges connect nodes on the canvas.
741
+
742
+ ```json
743
+ {
744
+ "id": "edge-1",
745
+ "fromNode": "node-1-id",
746
+ "fromSide": "right",
747
+ "toNode": "node-2-id",
748
+ "toSide": "left",
749
+ "color": "1",
750
+ "label": "Connection"
751
+ }
752
+ ```
753
+
754
+ ## References
755
+
756
+ - [Obsidian Flavored Markdown](https://help.obsidian.md/obsidian-flavored-markdown)
757
+ - [Obsidian Bases Syntax](https://help.obsidian.md/bases/syntax)
758
+ - [JSON Canvas Specification](https://jsoncanvas.org/)
759
+ - [obsidian-skills repository](https://github.com/kepano/obsidian-skills) - Source of comprehensive syntax documentation