Published on

Markdown/MDX文件格式用法

Authors

简介

Markdown 和 Mdx 的解析是通过 unified 以及其他 remark 和 rehype 包实现的。next-mdx-remote 使我们能够以更灵活的方式解析 .mdx 和 .md 文件,而无需触及 Webpack。

项目使用了 GitHub Flavored Markdown(GitHub 风味 Markdown)。mdx-prism 为代码块提供了语法高亮功能。以下是一个完整的演示。

下面的 Markdown 备忘单改编自:https://guides.github.com/features/mastering-markdown/

什么是 Markdown?

Markdown 是一种用于在网络上设置文本样式的方式。你可以控制文档的显示;将文字格式化为粗体或斜体、添加图片和创建列表等,都只是我们用 Markdown 可以做的几件事。在大多数情况下,Markdown 只是普通的文本,其中散布着一些非字母字符,例如 # 或 *。

语法指南(Syntax)

以下是 Markdown 语法的概述,你可以在 GitHub.com 上的任何地方或你自己的文本文件中使用。

标题

# This is a h1 tag

## This is a h2 tag

#### This is a h4 tag

这是一级标题(h1 tag)

这是二级标题(h2 tag)

这是四级标题(h4 tag)

强调

_This text will be italic_

**This text will be bold**

_You **can** combine them_

这段文字是斜体

这段文字是粗体

可以将它们组合使用

列表

无序列表

- Item 1
- Item 2
  - Item 2a
  - Item 2b
  • Item 1
  • Item 2
    • Item 2a
    • Item 2b

有序列表

1. Item 1
2. Item 2
3. Item 3
   1. Item 3a
   2. Item 3b
  1. Item 1
  2. Item 2
  3. Item 3
    1. Item 3a
    2. Item 3b

图片

![GitHub Logo](https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png)
Format: ![Alt Text](url)

GitHub Logo

链接

http://github.com - automatic!
[GitHub](http://github.com)

http://github.com - automatic! GitHub

引用块 (Blockquotes)

As Kanye West said:

> We're living the future so
> the present is our past.

As Kanye West said:

We're living the future so the present is our past.

行内代码(Inline code)

I think you should use an
`<addr>` element here instead.

I think you should use an <addr> element here instead.

语法高亮(Syntax highlighting)

以下示例如何使用 GitHub Flavored Markdown语法高亮:

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

它看起来就像这样——带有样式的代码标题和漂亮的颜色!

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

脚注(Footnotes)

Here is a simple footnote[^1]. With some additional text after it.

[^1]: My reference.

Here is a simple footnote1. With some additional text after it.

任务列表(Task Lists)

- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete item
  • list syntax required (any unordered or ordered list supported)
  • this is a complete item
  • this is an incomplete item

表格(Tables)

你可以通过组合一系列文字,并用连字符 -(用于第一行)分隔,然后用竖线 | 分隔每一列来创建表格:

| First Header                | Second Header                |
| --------------------------- | ---------------------------- |
| Content from cell 1         | Content from cell 2          |
| Content in the first column | Content in the second column |
First HeaderSecond Header
Content from cell 1Content from cell 2
Content in the first columnContent in the second column

删除线(Strikethrough)

任何用两个波浪线包裹的单词(例如~~this~~)都会显示为 被划掉

Footnotes

  1. My reference.

匿名评论