mcpField
O
obsidian-markdown

obsidian-markdown

github.com/davila7生产力33.0k519 次安装今天更新
代码仓库

关于 obsidian-markdown

obsidian-markdown 是面向 Claude Code 的技能,用于创建和编辑符合 Obsidian Flavored Markdown 规范的笔记,涵盖 Obsidian 扩展语法及常见 Markdown 功能。

主要功能

  1. 01Obsidian 双向链接与嵌入
  2. 02标注块与属性
  3. 03Markdown 格式与表格
  4. 04LaTeX 数学公式与 Mermaid 图表

适用场景

  1. 01起草带链接的 Obsidian 笔记
  2. 02编辑含标注块和嵌入内容的笔记
  3. 03在笔记中编写公式或图表

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/davila7/claude-code-templates --skill obsidian-markdown

安装后在 Claude Code 中输入/obsidian-markdown确认已加载。

详细介绍

Obsidian Flavored Markdown 技能

此技能使 Claude Code 能够创建和编辑有效的 Obsidian Flavored Markdown,包括所有 Obsidian 特有的语法扩展。

概述

Obsidian 结合使用多种 Markdown 变体:

基本格式

段落与换行
This is a paragraph.

This is another paragraph (blank line between creates separate paragraphs).

For a line break within a paragraph, add two spaces at the end  
or use Shift+Enter.
标题
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
文本格式
样式语法示例输出
粗体**text** 或 __text__**Bold**Bold
斜体*text* 或 _text_*Italic*Italic
粗体 + 斜体***text******Both***Both
删除线~~text~~~~Striked~~Striked
高亮==text====Highlighted====Highlighted==
行内代码`code``code`code
转义格式

使用反斜杠转义特殊字符:

\*This won't be italic\*
\#This won't be a heading
1\. This won't be a list item

常见需要转义的字符:\*、\_、\#、\`、\|、\~

内部链接(Wikilinks)

基本链接
[[Note Name]]
[[Note Name.md]]
[[Note Name|Display Text]]
链接到标题
[[Note Name#Heading]]
[[Note Name#Heading|Custom Text]]
[[#Heading in same note]]
[[##Search all headings in vault]]
链接到块
[[Note Name#^block-id]]
[[Note Name#^block-id|Custom Text]]

在段落末尾添加 ^block-id 来定义块 ID:

This is a paragraph that can be linked to. ^my-block-id

对于列表和引用,将块 ID 添加在单独的一行:

> This is a quote
> With multiple lines

^quote-id
搜索链接
[[##heading]]     Search for headings containing "heading"
[[^^block]]       Search for blocks containing "block"

Markdown 风格链接

[Display Text](Note%20Name.md)
[Display Text](Note%20Name.md#Heading)
[Display Text](https://example.com)
[Note](obsidian://open?vault=VaultName&file=Note.md)

注意:在 Markdown 链接中,空格必须 URL 编码为 %20。

嵌入

嵌入笔记
![[Note Name]]
![[Note Name#Heading]]
![[Note Name#^block-id]]
嵌入图片
![[image.png]]
![[image.png|640x480]]    Width x Height
![[image.png|300]]        Width only (maintains aspect ratio)
外部图片
![Alt text](https://example.com/image.png)
![Alt text|300](https://example.com/image.png)
嵌入音频
![[audio.mp3]]
![[audio.ogg]]
嵌入 PDF
![[document.pdf]]
![[document.pdf#page=3]]
![[document.pdf#height=400]]
嵌入列表
![[Note#^list-id]]

其中列表已通过块 ID 定义:

- Item 1
- Item 2
- Item 3

^list-id
嵌入搜索结果
```query
tag:#project status:done
```

Callouts

基本 Callout
> [!note]
> This is a note callout.

> [!info] Custom Title
> This callout has a custom title.

> [!tip] Title Only
可折叠 Callout
> [!faq]- Collapsed by default
> This content is hidden until expanded.

> [!faq]+ Expanded by default
> This content is visible but can be collapsed.
嵌套 Callout
> [!question] Outer callout
> > [!note] Inner callout
> > Nested content
支持的 Callout 类型
类型别名描述
note-蓝色,铅笔图标
abstractsummary、tldr青色,剪贴板图标
info-蓝色,信息图标
todo-蓝色,复选框图标
tiphint、important青色,火焰图标
successcheck、done绿色,对勾图标
questionhelp、faq黄色,问号
warningcaution、attention橙色,警告图标
failurefail、missing红色,X 图标
dangererror红色,闪电图标
bug-红色,虫子图标
example-紫色,列表图标
quotecite灰色,引用图标
自定义 Callout(CSS)
.callout[data-callout="custom-type"] {
  --callout-color: 255, 0, 0;
  --callout-icon: lucide-alert-circle;
}

列表

无序列表
- Item 1
- Item 2
  - Nested item
  - Another nested
- Item 3

* Also works with asterisks
+ Or plus signs
有序列表
1. First item
2. Second item
   1. Nested numbered
   2. Another nested
3. Third item

1) Alternative syntax
2) With parentheses
任务列表
- [ ] Incomplete task
- [x] Completed task
- [ ] Task with sub-tasks
  - [ ] Subtask 1
  - [x] Subtask 2

引用

> This is a blockquote.
> It can span multiple lines.
>
> And include multiple paragraphs.
>
> > Nested quotes work too.

代码

行内代码
Use `backticks` for inline code.
Use double backticks for ``code with a ` backtick inside``.
代码块
```
Plain code block
```

```javascript
// Syntax highlighted code block
function hello() {
  console.log("Hello, world!");
}
```

```python
# Python example
def greet(name):
    print(f"Hello, {name}!")
```
嵌套代码块

在外层块使用更多的反引号或波浪号:

````markdown
Here's how to create a code block:
```js
console.log("Hello")
```
````

表格

| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |
对齐
| Left     | Center   | Right    |
|:---------|:--------:|---------:|
| Left     | Center   | Right    |
在表格中使用管道符

使用反斜杠转义管道符:

| Column 1 | Column 2 |
|----------|----------|
| [[Link\|Display]] | ![[Image\|100]] |

数学公式(LaTeX)

行内数学
This is inline math: $e^{i\pi} + 1 = 0$
块级数学
$$
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix} = ad - bc
$$
常见数学语法
$x^2$              Superscript
$x_i$              Subscript
$\frac{a}{b}$      Fraction
$\sqrt{x}$         Square root
$\sum_{i=1}^{n}$   Summation
$\int_a^b$         Integral
$\alpha, \beta$    Greek letters

图表(Mermaid)

```mermaid
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Do this]
    B -->|No| D[Do that]
    C --> E[End]
    D --> E
```
序列图
```mermaid
sequenceDiagram
    Alice->>Bob: Hello Bob
    Bob-->>Alice: Hi Alice
```
在图表中链接
```mermaid
graph TD
    A[Biology]
    B[Chemistry]
    A --> B
    class A,B internal-link;
```

脚注

This sentence has a footnote[^1].

[^1]: This is the footnote content.

You can also use named footnotes[^note].

[^note]: Named footnotes still appear as numbers.

Inline footnotes are also supported.^[This is an inline footnote.]

注释

This is visible %%but this is hidden%% text.

%%
This entire block is hidden.
It won't appear in reading view.
%%

分隔线

---
***
___
- - -
* * *

属性(Frontmatter)

属性使用位于笔记开头的 YAML frontmatter:

---
title: My Note Title
date: 2024-01-15
tags:
  - project
  - important
aliases:
  - My Note
  - Alternative Name
cssclasses:
  - custom-class
status: in-progress
rating: 4.5
completed: false
due: 2024-02-01T14:30:00
---
属性类型
类型示例
文本title: My Title
数字rating: 4.5
复选框completed: true
日期date: 2024-01-15
日期与时间due: 2024-01-15T14:30:00
列表tags: [one, two] 或 YAML 列表
链接related: "[[Other Note]]"
默认属性
  • tags - 笔记标签
  • aliases - 笔记的替代名称
  • cssclasses - 应用于笔记的 CSS 类

标签

#tag
#nested/tag
#tag-with-dashes
#tag_with_underscores

In frontmatter:
---
tags:
  - tag1
  - nested/tag2
---

标签可以包含:

  • 字母(任意语言)
  • 数字(不能作为第一个字符)
  • 下划线 _
  • 连字符 -
  • 正斜杠 /(用于嵌套)

HTML 内容

Obsidian 支持在 Markdown 中使用 HTML:

<div class="custom-container">
  <span style="color: red;">Colored text</span>
</div>

<details>
  <summary>Click to expand</summary>
  Hidden content here.
</details>

<kbd>Ctrl</kbd> + <kbd>C</kbd>

完整示例

---
title: Project Alpha
date: 2024-01-15
tags:
  - project
  - active
status: in-progress
priority: high
---

# Project Alpha

## Overview

This project aims to [[improve workflow]] using modern techniques.

> [!important] Key Deadline
> The first milestone is due on ==January 30th==.

## Tasks

- [x] Initial planning
- [x] Resource allocation
- [ ] Development phase
  - [ ] Backend implementation
  - [ ] Frontend design
- [ ] Testing
- [ ] Deployment

## Technical Notes

The main algorithm uses the formula $O(n \log n)$ for sorting.

```python
def process_data(items):
    return sorted(items, key=lambda x: x.priority)
```

## Architecture

```mermaid
graph LR
    A[Input] --> B[Process]
    B --> C[Output]
    B --> D[Cache]
```

## Related Documents

- ![[Meeting Notes 2024-01-10#Decisions]]
- [[Budget Allocation|Budget]]
- [[Team Members]]

## References

For more details, see the official documentation[^1].

[^1]: https://example.com/docs

%%
Internal notes:
- Review with team on Friday
- Consider alternative approaches
%%

参考资料

评论

支持 Markdown