Obsidian语法

2025-05-09 553
Obsidian

类型:笔记软件

简介:一款功能强大且支持中文的全平台笔记软件,别名“黑曜石”。

在Markdown中,创建段落的方法是使用空行将文本块分隔开。每个由空行分开的文本块都会被视作一个独立的段落。接下来将由站长百科主要介绍Obsidian如何使用Markdown格式在笔记中应用基础语法。

一、Obsidian段落

例如:

This is a paragraph.

This is another paragraph.

以上会显示为:

这是一个段落。

这是另一段。

二、Obsidian多个空格

在阅读视图或Obsidian Publish网站中,段落内部和段落间的多个空格会自动折叠为一个空格。

Multiple adjacent spaces

 

and multiple newlines between paragraphs.

会被渲染为:

多个相邻空间

以及段落之间的多个换行符。

如果想保留多个空格或添加额外的空格,可以使用HTML标签&nbsp;(不间断空格)或者<br>(换行符)。

三、Obsidian换行符

默认情况下,在Obsidian中按一次Enter键会创建新的一行,但该行仍会被视为同一段落的延续。要在段落中插入换行符而不开始新段落,可以在行尾添加两个空格,再按Enter,或者使用快捷键Shift+Enter。

如果你希望Obsidian遵循标准的Markdown换行符规则,可以启用“StrictLineBreaks”功能。设置方法如下:

1、打开设置(Settings)。

2、转到“编辑器”选项卡。

3、启用“StrictLineBreaks”。

4、启用后,换行符会有三种不同的行为:

无尾随空格的单回车:没有尾随空格的单行将会被合并成一行。

例子:

line one
line two

渲染为:

第一行 第二行

带有尾随空格的单回车:在行尾加上两个或更多空格后按回车,会在同一段落中插入换行符。

例子:

line three__
line four

渲染为:

第三行

第四行

双回车:按两次Enter会将行分为两个段落,不管是否有空格。

例子:

line five

line six

渲染为:

第五行

第六行

四、Obsidian标题

要创建标题,只需在文本前添加1到6个#符号,符号的数量决定了标题的层级。

例如:

# This is a heading 1
## This is a heading 2
### This is a heading 3
#### This is a heading 4
##### This is a heading 5
###### This is a heading 6

会显示为:

Obsidian语法

五、Obsidian粗体、斜体、高亮

你可以通过快捷键或Markdown语法来应用文本格式:

Obsidian语法

如果要在文本中显示格式字符而不触发格式化,可以在前面加上反斜杠\来转义。例如:

**此行不会加粗**

\*\*This line will not be bold\*\*

*此行将为斜体并显示星号*

\**This line will be italic and show the asterisks*\*

六、Obsidian内部链接

Obsidian支持两种格式的内部链接:

  • 维基链接:[[Three laws of motion]]
  • Markdown:[Three laws of motion](Three%20laws%20of%20motion.md)

七、Obsidian外部链接

创建外部链接可以使用以下语法:

[Obsidian Help](https://help.obsidian.md)

你还可以通过链接ObsidianURI来指向Vault中的文件:

[Note](obsidian://open?vault=MainVault&file=Note.md)

八、Obsidian外部图像

可以通过在外部链接前添加!来插入图像:

![Engelbart](https://history-computer.com/ModernComputer/Basis/images/Engelbart.jpg)

你还可以通过在链接后指定尺寸来调整图像大小:

![Engelbart|100×145](https://history-computer.com/ModernComputer/Basis/images/Engelbart.jpg)

如果仅指定宽度,则图像将根据其原始长宽比进行缩放。例如:

![Engelbart|100](https://history-computer.com/ModernComputer/Basis/images/Engelbart.jpg)

九、Obsidian引用文本

要引用文本,可以在文本前添加>符号:

> Human beings face ever more complex and urgent problems, and their effectiveness in dealing with these problems is a matter that is critical to the stability and continued progress of society.

\- Doug Engelbart, 1961

会显示为:

人类面临着越来越复杂和紧迫的问题,他们如何有效地处理这些问题,是关系到社会稳定和持续进步的关键问题。

—道格·恩格尔巴特,1961

十、Obsidian列表

无序列表:在每一项前使用-、*或+。

例如:

– First list item
– Second list item
– Third list item

渲染为:

第一个列表项
第二个列表项
第三个列表项

有序列表:在每一项前使用数字和点号。

例如:

1. First list item
2. Second list item
3. Third list item

渲染为:

第一个列表项
第二个列表项
第三个列表项

十一、Obsidian任务列表

要创建任务列表,在每个列表项前加上[]表示未完成的任务,[x]表示已完成的任务:

– [x] This is a completed task.
– [ ] This is an incomplete task.

渲染为:

[x]这是一个已完成的任务。
[]这是一个未完成的任务。

十二、嵌套列表

你可以将列表嵌套在其他列表中。只需缩进子项即可:

1. First list item
1. Ordered nested list item
2. Second list item
– Unordered nested list item

十三、水平标尺

要插入水平线,可以使用三个或更多的星号*、连字符-或下划线_。

例如:

***
****
* * *

—-
– – –
___
____
_ _ _

十四、内联代码

使用单个反引号`将代码嵌入文本中。

Text inside `backticks` on a line will be formatted like code.

十五、多行代码块

使用三个反引号“`来创建多行代码块。

“`
cd ~/Desktop
“`

~~~
cd ~/Desktop
~~~

cd ~/Desktop

还可以通过使用Tab或 4 个空格缩进文本来创建代码块。

cd ~/Desktop

您可以通过在第一组反引号后添加语言代码,向代码块添加语法高亮显示。

“`js
function fancyAlert(arg) {
if(arg) {
$.facebox({div:’#foo’})
}
}
“`

function fancyAlert(arg) {
if(arg) {
$.facebox({div:’#foo’})
}
}

十六、脚注

可以使用以下语法将 footnotes[1] 添加到您的注释中:

This is a simple footnote[^1].

[^1]: This is the referenced text.
[^2]: Add 2 spaces at the start of each new line.
This lets you write footnotes that span multiple lines.
[^note]: Named footnotes still appear as numbers, but can make it easier to identify and link references.

您还可以在句子中内联脚注。请注意,插入符号位于括号之外。

You can also use inline footnotes. ^[This is an inline footnote.]

十七、评论

可以通过用 .注释仅在 Editing (编辑) 视图中可见。%%

This is an %%inline%% comment.

%%
This is a block comment.

Block comments can span multiple lines.
%%

  • 广告合作

  • QQ群号:4114653

温馨提示:
1、本网站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。邮箱:2942802716#qq.com(#改为@)。 2、本站原创内容未经允许不得转裁,转载请注明出处“站长百科”和原文地址。
Obsidian
上一篇: Obsidian标签