Markdown常用命令

Headers

Headers use 1-6 hash (#) characters at the start of the line, corresponding to header levels 1-6. For example:

# This is an H1
​
## This is an H2
​
###### This is an H6

In Typora, input ‘#’s followed by title content, and press Return key will create a header.

Blockquotes

Markdown uses email-style > characters for block quoting. They are presented as:

This is a blockquote with two paragraphs. This is first paragraph.

This is second pragraph. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
This is another blockquote with one paragraph. There is three empty line to seperate two blockquote.

In Typora, inputting ‘>’ followed by your quote contents will generate a quote block. Typora will insert a proper ‘>’ or line break for you. Nested block quotes (a block quote inside another block quote) by adding additional levels of ‘>’.

嵌套块引用(Nested Blockquotes)

块引用可以嵌套。在要嵌套的段落前添加一个 >> 符号。

Dorothy followed her through many of the beautiful rooms in her castle.

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Lists

Input * list item 1 will create an unordered list - the * symbol can be replace with + or -.

Input 1. list item 1 will create an ordered list - their markdown source code is as follows:

un-ordered list

  • Red
  • Green
  • Blue

ordered list

  1. Red
  2. Green
  3. Blue
    (Fenced) Code Blocks

Typora only supports fences in GitHub Flavored Markdown. Original code blocks in markdown are not supported.

Using fences is easy: Input ``` and press return. Add an optional language identifier after ```` and we'll run it through syntax highlighting:

Here's an example:

function test() {
  console.log("notice the blank line before this function?");
}

syntax highlighting:

require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

Horizontal Rules

Inputting *** or --- on a blank line and pressing return will draw a horizontal line.

Table of Contents (TOC)

Input [toc] and press the Return key. This will create a “Table of Contents” section. The TOC extracts all headers from the document, and its contents are updated automatically as you add to the document.

Links

Markdown supports two styles of links: inline and reference.
In both styles, the link text is delimited by [square brackets].

To create an inline link, use a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses, put the URL where you want the link to point, along with an optional title for the link, surrounded in quotes. For example:

This is [an example](http://example.com/ "Title") inline link.

渲染效果:
an example

要将 URL 或电子邮件地址快速转换为链接,请将其括在尖括号中。

<https://www.markdownguide.org>

<fake@example.com>

渲染效果:

https://www.markdownguide.org

fake@example.com

Emphasis

Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML tag. E.g:

*single asterisks*

_single underscores_

output:

single asterisks

single underscores

GFM will ignore underscores in words, which is commonly used in code and names, like this:

wow_great_stuff

do_this_and_do_that_and_another_thing.

To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:

*this text is surrounded by literal asterisks*

Typora recommends using the * symbol.

Strong

A double * or _ will cause its enclosed contents to be wrapped with an HTML tag, e.g:

**double asterisks**

__double underscores__

output:

double asterisks

double underscores

Typora recommends using the ** symbol.

粗体(Bold)和斜体(Italic)

要同时用粗体和斜体突出显示文本,请在单词或短语的前后各添加三个星号或下划线。要加粗并用斜体显示单词或短语的中间部分,请在要突出显示的部分前后各添加三个星号,中间不要带空格。

Code

To indicate an inline span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph. For example:

Use the `printf()` function.

will produce:

Use the printf() function.

公式

行中公式(放在文中与其它文字混编)可以用如下方法表示:$ 数学公式 $

独立公式可以用如下方法表示:$$ 数学公式 $$

^ 表示上标, _ 表示下标。如果上下标的内容多于一个字符,需要用 {}将这些内容括成一个整体。上下标可以嵌套,也可以同时使用。

表格

表头 表头
单元格 单元格
单元格 单元格

设置表格的对齐方式:

  • -: 设置内容和标题栏居右对齐。
  • :- 设置内容和标题栏居左对齐。
  • :-: 设置内容和标题栏居中对齐
posted @ 2022-01-04 11:31  源世  阅读(72)  评论(0编辑  收藏  举报