文章详情 学习笔记

Markdown使用

发布时间:2026-04-08 11:49 浏览次数:172 最后更新:2026-04-08 11:51

Markdown

正文内容

标题

语法: # (一级标题) ## (二级标题) ### (三级标题) ......

代码:

# (一级标题)
## (二级标题)
### (三级标题)

注意:#号键和文字之间有一个空格,否则无法生效。

快捷键:

  • Ctrl+数字1-6可以快速将选中的文本调整为对应级别的标题(数字为键盘上的横排数字)

  • Ctrl+0可以快速将选中的文本调整为普通文本

  • Ctrl+加号/减号可以对标题级别进行加减

段落

换行

语法:

  • 大换行:使用回车键

  • 小换行:使用Shift+回车键

区别:大换行实际上插入了两个换行符,其两行之间有一个空白行。小换行则表现为两行紧挨着,实际上只插入了一个换行符。

分割线

语法:三个减号或三个星号,然后按下回车键即可生成分割线

---
或者
***

效果:


文字

字体

语法:

  • 粗体:用一对双星号包裹

  • 删除线:用一对双波浪线包裹

  • 下划线:用一对u标签包裹

  • 斜体:用一对单星号包裹

  • 高亮:用一对双等号包裹

代码

**这是粗体**
~~这是删除线~~
<u>这是下划线</u>
*这是斜体*
==这是高亮==

效果:

这是粗体

这是删除线

<u>这是下划线</u>

这是斜体

这是高亮

快捷键:

  • 加粗:Ctrl+B

  • 删除线:Shift+Alt+5

  • 下划线:Ctrl+U

  • 斜体:Ctrl+L

注意:这些符号可以随意组合形成多种样式。若需要输入这些符号则需要转义符:\,如*5*

上下标

语法:

x^2^
H~2~O

效果:

x2 H2O

注意:此上下标存在局限性,公式中的上下标有特定的写法

颜色

语法:

#字体显示为蓝色
&lt;font color=&quot;blue&quot;&gt;test&lt;/font&gt;
#字体显示为蓝色
&lt;font color=&quot;#0000FF&quot;&gt;test&lt;/font&gt;


#背景显示为红色
&lt;font style=&quot;background:red&quot;&gt;test&lt;/font&gt;
#背景显示为红色
&lt;font style=&quot;background:#FF0000&quot;&gt;test&lt;/font&gt;
#背景显示为红色
&lt;span style=&quot;background:#FF0000&quot;&gt;test&lt;/span&gt;
#背景显示为红色
&lt;span style=&quot;background:#FF0000&quot;&gt;test&lt;/span&gt;

如:

<font color="blue">test</font>

<font color="#0000FF">test</font>

<font style="background:red">test</font>

<font style="background:#FF0000">test</font>

<span style="background:#FF0000">test</span>

列表

无序列表

代码:

*或-或+ 加 空格
使用Tab键可以提升级数
使用Shift+Tab降低级数
连续降低级数可以使其变为普通文本

效果:

  • 这是一级标题
    • 这是二级标题
      • 这是三级分类

快捷键:Ctrl+Shift+]

有序列表

代码:

数字 加 . 加 空格
使用Tab键可以提升级数
使用Shift+Tab降低级数
连续降低级数可以使其变为普通文本

效果:

  1. 内容一

  2. 内容二

快捷键:Ctrl+Shift+[

任务列表

代码:

- [ ] 吃早餐
- [x] 背单词
Shift+Tab可以降低为普通文本

效果:

  • 吃早餐
  • 背单词

区块显示

代码:

&gt;加 空格
Shift+Tab可以降低为普通文本

效果:

> 这是最外层区块

>> 这是第二层区块

>>> 这是最里层区块

代码显示

行内代码

代码:

`int a=0;`
`号键在数字1键的旁边,ESC键的下方(英文格式下)

效果:

int a=0;

快捷键:Ctrl+Shift+`

代码块

代码:

```js/java/C#/text 加 回车
其中js/java/C#/text这些可写可不写
当写了代码类型时,编辑器可为其语言使用特定的颜色

如果要跳出代码块另起一行需使用 Ctrl+回车键 

如:

using test;
namespace testNamespace
{
    class testClass
    {
        private static Test()
        {
            int i=10;
            return;
        }
    }
}

快捷键:Ctrl+Shift+K

链接

代码:

www.baidu.com
显示为链接

[百度一下](https://www.baidu.com)
显示为文字链接

[百度一下](https://www.baidu.com &quot;跳转https://www.baidu.com&quot;)
当鼠标置于文字上出现提示

[标题一](#一、标题)
注意:使用页内标题跳转时注意书写格式,#和文字之间不能有空格

使用Ctrl+鼠标左键点击链接可以直接跳转

效果:

www.baidu.com 百度一下 [百度一下](https://www.baidu.com "跳转https://www.baidu.com")

标题一

快捷键:Ctrl+K

脚注

作用:对文本进行解释说明。

代码:

文本[^1]
[^1]:解释说明

当鼠标置于标注上会显示解释说明文本
使用Ctrl+鼠标左键点击可以在标注和解释之间跳转

若要将脚注解释说明文本换行,可以在换行处插入&lt;br&gt;标签
是否显性的显示&lt;br&gt;标签可以在设置里面更改

效果:

> 文本[^1] > > [^1]: 解释说明

> 文本[^点击跳转] > > [^点击跳转]: 这是一行很长的说明<br> 这是第二行

#图片插入 代码:

![示例内容](https://example.com/image.png)

效果:

测试图片

插入视频

&lt;--!我们只需要把src的值改成文件的位置即可--&gt;
&lt;video id=&quot;video&quot; controls=&quot;&quot; src=&quot;文件位置&quot; preload=&quot;none&quot;&gt;
    
这里要提醒一下mac用户,mac的根目录位置为/Users/用户名,并不是我们命令行中用的~

表格

使用快捷键:Ctrl+T(表格代码很复杂,很难直接输入(可以在源代码中查看表格语法))

输入行数和列数后会生成一个表格

此时可以在表格中填写内容。

在表格中换行可以使用 Shift+回车键 来进行换行

表情

代码:

:happy:、:cry:、:man:

效果:

:happy:、:cry:、:man:

#自动生成大纲序号以及标题序号

在文件夹中创建base.user.css文件,在文件中输入如下代码即可:

/*文章标题自动编号*/
/** initialize css counter */
#write {
    counter-reset: h1
    }
    h1 {
    counter-reset: h2
    }
    h2 {
    counter-reset: h3
    }
    h3 {
    counter-reset: h4
    }
    h4 {
    counter-reset: h5
    }
    h5 {
    counter-reset: h6
    }
    /** put counter result into headings */
    #write h1:before {
    counter-increment: h1;
    content: counter(h1) &quot;. &quot;
    }
    #write h2:before {
    counter-increment: h2;
    content: counter(h1) &quot;.&quot; counter(h2) &quot; &quot;
    }
    #write h3:before,
    h3.md-focus.md-heading:before /** override the default style for focused headings */ {
    counter-increment: h3;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot; &quot;
    }
    #write h4:before,
    h4.md-focus.md-heading:before {
    counter-increment: h4;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot;.&quot; counter(h4) &quot; &quot;
    }
    #write h5:before,
    h5.md-focus.md-heading:before {
    counter-increment: h5;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot;.&quot; counter(h4) &quot;.&quot; counter(h5) &quot; &quot;
    }
    #write h6:before,
    h6.md-focus.md-heading:before {
    counter-increment: h6;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot;.&quot; counter(h4) &quot;.&quot; counter(h5) &quot;.&quot; counter(h6) &quot; &quot;
    }
    /** override the default style for focused headings */
    #write&gt;h3.md-focus:before,
    #write&gt;h4.md-focus:before,
    #write&gt;h5.md-focus:before,
    #write&gt;h6.md-focus:before,
    h3.md-focus:before,
    h4.md-focus:before,
    h5.md-focus:before,
    h6.md-focus:before {
    color: inherit;
    border: inherit;
    border-radius: inherit;
    position: inherit;
    left:initial;
    float: none;
    top:initial;
    font-size: inherit;
    padding-left: inherit;
    padding-right: inherit;
    vertical-align: inherit;
    font-weight: inherit;
    line-height: inherit;
    }

/*文章大纲自动编号*/
.sidebar-content {
    counter-reset: h1
}

.outline-h1 {
    counter-reset: h2
}
 
.outline-h2 {
    counter-reset: h3
}
 
.outline-h3 {
    counter-reset: h4
}
 
.outline-h4 {
    counter-reset: h5
}
 
.outline-h5 {
    counter-reset: h6
}


.outline-h1&gt;.outline-item&gt;.outline-label:before {
    counter-increment: h1;
    content: counter(h1) &quot; &quot;
}

.outline-h2&gt;.outline-item&gt;.outline-label:before {
    counter-increment: h2;
    content: counter(h1) &quot;.&quot; counter(h2) &quot; &quot;
}
 
.outline-h3&gt;.outline-item&gt;.outline-label:before {
    counter-increment: h3;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot; &quot;
}
 
.outline-h4&gt;.outline-item&gt;.outline-label:before {
    counter-increment: h4;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot;.&quot; counter(h4) &quot; &quot;
}
 
.outline-h5&gt;.outline-item&gt;.outline-label:before {
    counter-increment: h5;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot;.&quot; counter(h4) &quot;.&quot; counter(h5) &quot; &quot;
}
 
.outline-h6&gt;.outline-item&gt;.outline-label:before {
    counter-increment: h6;
    content: counter(h1) &quot;.&quot; counter(h2) &quot;.&quot; counter(h3) &quot;.&quot; counter(h4) &quot;.&quot; counter(h5) &quot;.&quot; counter(h6) &quot; &quot;
}

正文内容已启用复制保护,代码块仍支持复制。

评论区

0 条已展示评论
发表评论

发表评论

提交后将进入人工审核,审核通过后才会展示。

邮箱仅用于必要的联系与基础风控,不会在页面中公开展示。

评论内容最多 1000 个字符。 0 / 1000

请文明发言,避免发布广告、链接或敏感内容;短时间内频繁提交会被限制。

隐私提示:提交评论即表示你同意站点为评论展示、审核、防刷与安全风控目的处理你填写的昵称、邮箱和评论内容。

其中邮箱不会公开展示,也不会用于与评论无关的公开用途。

已展示评论

读者留言

以下仅展示已通过审核的评论内容。

0 条评论
当前还没有通过审核的评论,后续可在后台审核后展示。