Markdown and how to use markdown into html

title

  • A title: the title content # + space +
  • Subheadings ## I: How many levels will increase the number # in front of the title, such as: Secondary title

List

  • Ordered list: 1 + space + content
  • Unordered list: * + space + content
  • Two lists: tab + * + space + content
  • Multilevel list: Multiple tab + * + space + content

image

The format is:

 ![在这里插入图片描述](图片的路径)

link

The format is:

 [链接](https://www.baidu.com)

Emphasize

  1. Italic
  *斜体*
  1. Bold
 **加粗**
  1. Bold italic
  ***粗斜体***

Wrap

The end of a line plus more than two spaces and then enter

Quote

Quote

 格式为:
 > 内容 

Block

```
    代码块
```

mailbox

  <[email protected]>

Horizontal dividing line


	***

form

markdown 表格语法
|一个标题|一个标题|
| ------ | ------ | ------ |
| 短文本 | 中等文本 | 稍微长一点的文本 |
| 稍微长一点的文本 | 短文本 | 中等文本 |

markdown table syntax

A title A title
Short text Moderate text
Slightly longer text Short text
  1. |, -,: extra spaces between are ignored, it does not affect the layout.
  2. The default title bar centered, left-aligned content ranking.
  3. -: that content and title bar ranks right alignment: - representing the content and title bar Left-aligned,: -: that content and title bar centered.
  4. Content and | extra spaces between are ignored, each line of the first | and the last one | can be omitted, - there is at least one number.

Markdown support turn the page displaying html

Use showdown.jsscript examples:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div id="test"></div>
        <script src="showdown.min.js"></script>
        <script type="text/javascript">
            var converter = new showdown.Converter(),
            text = "# title",   //需要显示的markdown笔记
            html = converter.makeHtml(text);
            document.getElementById('test').innerHTML = html;
        </script>
    </body>
    </html>

Guess you like

Origin blog.csdn.net/wang19970228/article/details/89578569