mcpField
O
obsidian-markdown

obsidian-markdown

github.com/oldwinter生产力1044 次安装1 周前更新
代码仓库

关于 obsidian-markdown

供 Agent 创建和编辑 Obsidian 笔记的 Markdown skill,涵盖标准 Markdown 及 Obsidian 扩展语法,包括双向链接、标注、嵌入和属性。

主要功能

  1. 01CommonMark 和 GitHub Flavored Markdown
  2. 02双向链接与块链接
  3. 03嵌入内容和标注
  4. 04属性与标签
  5. 05数学公式和 Mermaid 图表

适用场景

  1. 01按有效语法撰写 Obsidian 笔记
  2. 02在笔记之间添加链接和嵌入
  3. 03设置标注、属性和图表格式

安装

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

$npx skills add https://github.com/oldwinter/skills --skill obsidian-markdown

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

详细介绍

Obsidian 风格 Markdown 技能

此技能支持兼容技能的 Agent 创建和编辑有效的 Obsidian 风格 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

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

内部链接(维基链接)

基本链接
[[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 链接中的空格必须使用 %20 进行 URL 编码。

嵌入

嵌入笔记
![[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
```

标注

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

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

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

> [!faq]+ Expanded by default
> This content is visible but can be collapsed.
嵌套标注
> [!question] Outer callout
> > [!note] Inner callout
> > Nested content
支持的标注类型
类型别名描述
note-蓝色,铅笔图标
abstractsummary、tldr青绿色,剪贴板图标
info-蓝色,信息图标
todo-蓝色,复选框图标
tiphint、important青色,火焰图标
successcheck、done绿色,勾选图标
questionhelp、faq黄色,问号图标
warningcaution、attention橙色,警告图标
failurefail、missing红色,X 图标
dangererror红色,闪电图标
bug-红色,虫子图标
example-紫色,列表图标
quotecite灰色,引号图标
自定义标注(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