Memos的内容语法合集,参考使用
默认分类 2

内容语法

掌握 Markdown 和 Memos 特定语法,以获取丰富的格式化内容。

Memos 通过 GitHub 风格的 Markdown 支持丰富的内容格式化,并具有其他增强功能。本指南涵盖了从基本格式到高级功能的所有内容。

基本 Markdown

文本格式

**Bold text** or __Bold text__
*Italic text* or _Italic text_
***Bold and italic*** or ___Bold and italic___
~~Strikethrough text~~
`Inline code`

This is a paragraph with **bold**, *italic*, and `code` text.

结果:粗体文本斜体文本粗体和斜体删除线文本Inline code

# Header 1
## Header 2  
### Header 3
#### Header 4
##### Header 5
###### Header 6

标题会自动生成锚链接,以便于链接和导航。

列表

无序列表

- Item 1
- Item 2
  - Nested item
  - Another nested item
- Item 3

* Alternative syntax
+ Another alternative

有序列表

1. First item
2. Second item
   1. Nested item
   2. Another nested item
3. Third item

1. Lists can start with any number
5. The numbers don't need to be sequential
2. Markdown will auto-number them

任务列表

- [x] Completed task
- [ ] Incomplete task
- [x] Another completed task
  - [ ] Nested task
  - [x] Completed nested task

结果:

  • 已完成的任务

  • 未完成的任务

  • 另一个已完成的任务

链接和参考资料

基本链接

[Link text](https://example.com)
[Link with title](https://example.com "Tooltip text")

Auto-links: https://example.com
Email links: <email@example.com>

参考链接

[Link text][reference-id]
[Another link][1]

[reference-id]: https://example.com
[1]: https://example.com "Optional title"

内部链接

[Other memo](/docs/guides/getting-started)
[Specific section](/docs/guides/content-syntax#headers)

图像

基本图像

![Alt text](https://example.com/image.png)
![Alt text](https://example.com/image.png "Optional title")

带链接的图片

[![Alt text](image.png)](https://example.com)

图像存储:将图像直接上传到您的 Memos 实例或引用外部 URL。

代码和语法突出显示

内联代码

Use `const` for constant values.
File paths like `/etc/hosts` are formatted as code.

代码块

基本代码块

```
Plain code block without syntax highlighting
```

使用语法突出显示

```javascript
function greet(name) {
  return `Hello, ${name}!`;
}

const message = greet('World');
console.log(message);
```

支持的语言

支持的流行语言:

```bash
#!/bin/bash
echo "Shell script"
```

```python
def hello_world():
    print("Hello, World!")
```

```sql
SELECT * FROM users WHERE active = true;
```

```yaml
version: '3.8'
services:
  memos:
    image: neosmemo/memos:stable
```

```json
{
  "name": "memos",
  "version": "1.0.0"
}
```

```dockerfile
FROM alpine:latest
RUN apk add --no-cache ca-certificates
```

代码块功能

```javascript title="example.js"
// Code with title
const greeting = "Hello World";
```

```bash showLineNumbers
# Code with line numbers
npm install
npm start
```

高级格式

| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Row 1    | Data     | More data |
| Row 2    | Data     | More data |

| Left | Center | Right |
|:-----|:------:|------:|
| L    |   C    |     R |

结果:

第1栏

第2栏

第3栏

第 1 行

数据

更多数据

第 2 行

数据

更多数据

块报价

> This is a blockquote.
> 
> It can span multiple lines.

> **Note:** You can use other markdown inside blockquotes.
> 
> - Including lists
> - And other elements

结果:

这是一个块引用。

它可以跨越多行。

水平规则

Three or more hyphens:
---

Three or more asterisks:
***

Three or more underscores:
___

备忘录特定功能

标签

标签有助于组织和分类您的备忘录:

#work #project #urgent
#personal #ideas
#tech #programming #javascript

标记最佳实践

  • 使用小写以保持一致性

  • 用连字符分隔单词:#project-alpha

  • 创建层次结构:#work/project/alpha

  • 具体但不要过于细化

提到

参考其他用户或备忘录:

@username mentioned in this memo
Reference another memo: [[memo-title]]

特殊语法

时间 戳

Current time: {{NOW}}
Specific date: {{2025-08-19}}

变量

{{VARIABLE_NAME}} will be replaced with defined values

数学表达式

Memos 支持 LaTeX 风格的数学符号:

内联数学

The quadratic formula is $x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$.

块数学

$$
\begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &= \frac{4\pi}{c}\vec{\mathbf{j}} \\
\nabla \cdot \vec{\mathbf{E}} &= 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &= \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} &= 0
\end{aligned}
$$

美人鱼图表

使用 Mermaid 语法创建图表:

流程图

```mermaid
graph TD
    A[Start] --> B{Is it working?}
    B -->|Yes| C[Great!]
    B -->|No| D[Debug]
    D --> B
    C --> E[End]
```

序列图

```mermaid
sequenceDiagram
    participant U as User
    participant M as Memos
    participant D as Database
    
    U->>M: Create memo
    M->>D: Save data
    D-->>M: Confirm
    M-->>U: Success response
```

Git 图

```mermaid
gitgraph
    commit id: "Initial"
    branch develop
    checkout develop
    commit id: "Feature A"
    checkout main
    commit id: "Hotfix"
    checkout develop
    commit id: "Feature B"
    checkout main
    merge develop
```

嵌入和媒体

YouTube 视频

![YouTube Video](https://www.youtube.com/watch?v=VIDEO_ID)

外部内容

[Embed: Website Title](https://example.com)

HTML 支持

高级格式支持有限的 HTML:

<details>
<summary>Click to expand</summary>

This content is hidden by default.

</details>

<kbd>Ctrl</kbd> + <kbd>C</kbd> for copy

<mark>Highlighted text</mark>

<sub>Subscript</sub> and <sup>Superscript</sup>

提示和最佳实践

撰写有效的备忘录

  1. 使用描述性标题 - 使备忘录易于查找

  2. 标题的结构 - 分解长内容

  3. 一致地标记 - 制定标记策略

  4. 链接相关内容 - 在备忘录之间创建连接

性能提示

  1. 优化图像 - 使用适当的文件大小

  2. 限制大表 - 分成更小的部分

  3. 适度的数学表达式 - 复杂的公式会减慢渲染速度

可及性

  1. 对图像使用替代文本 - 为屏幕阅读器描述图像

  2. 有意义的链接文本 - 避免“单击此处”链接

  3. 正确的标题层次结构 - 逻辑地使用 h1、h2、h3

  4. 高对比度 - 确保文本可读

专业提示

在编辑时使用预览模式,在保存之前查看您的内容将如何呈现!

快速参考

常用快捷键

元素

语法

大胆

**text**

斜体的

*text*

法典

text

链接

[text](url)

图像

![alt](url)

页眉

# text

列表

- item

任务

- [x] done

标记

#tag

报价

> text

高级功能

特征

语法

桌子

| col | col |

代码块

```lang

数学内联

$formula$

数学块

$$formula$$

美人鱼

```mermaid

[HTML全文]

<tag>content</tag>

Memos的内容语法合集,参考使用
https://dbeer.cn/archives/memos-syntax
作者
im𝔃𝔂𝔃
发布于
更新于
许可