Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Front-end learning Markdown

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Overview

The goal of Markdown is to make it easy to read and write, and a document written in Markdown format should be able to publish directly in plain text.

The syntax of Markdown consists entirely of symbols, and there are only a few types of syntax that correspond to a small number of HTML tags. Since Markdown is actually a simplified version of HTML, it is possible to write HTML directly.

Paragraph

A character without any symbol is a paragraph. Multiple paragraphs are separated by blank lines

[note] in markdown, multiple blank lines are merged into a single blank line display

P1 p2p3

The output HTML is

P1

P2

P3

New line

If there are no blank lines between paragraphs, it is resolved to a HTML tag

P1p2p3

The output HTML is

P1

P2

P3

Title

#, # and # correspond to In fact, I personally feel that it is not as convenient to use the tag directly, especially after heading 3.

# h2##h3###h4####h5#h6#h7

The output HTML is

H2h3h4h5h6h7 block

Speaking of blocks, few people may have heard of them. It is represented by the symbol'>', which corresponds to the tag in HTML and is used to refer to the block element. In the book "Head first HTML And CSS", it also makes a detailed distinction between and, but it is rarely used in practice.

However, the implementation of the corresponding block reference in markdown can not fully express the semantics of the tag and should be able to reference multiple paragraphs, but in fact, the'> 'symbol of markdown can only refer to one paragraph.

> p1p2

The output HTML is

P1

P2

List

[unordered list]

Unordered lists use asterisks, plus signs, and minus signs as item tags for the list

* red* blue* green+ red+ blue+ green- red- blue- green

The output HTML is

Red blue green

[ordered list]

An ordered list uses a normal number followed by an English period as an item tag.

1. Red2. Green3. Blue

The output HTML is

Red blue green

[note] if you insert a blank line between items, the contents of the project will use the

Wrap it up

Separation line

You can establish a separation line with more than three asterisks, minus signs, and bottom lines in a line, and there can be nothing else in the line. You can also insert spaces between asterisks or minus signs. You can establish a separation line in each of the following ways of writing

* *-

The output HTML is

Link

Markdown supports three forms of link syntax: inline, reference, and automatic. Both inline and reference links use angle brackets to convert text into links

[note] since the link generated by Markdown by default is the current page open and cannot implement _ blank, it is more convenient for individuals to use it directly.

[inline link]

The inline form is directly followed by a link in parentheses.

This is an [example link] (http://cnblogs.com/)

The output HTML is

This is anexample link

[reference link]

A link in reference form can give a name to the link, and then you can define the contents of the link elsewhere in the file. The title attribute is optional, and link names can be in letters, numbers, and spaces, but regardless of case

I get 10 times more traffic from [Google] [1] than from [Yahoo] [2] or [MSN] [3]. [1]: http://google.com/ "Google" [2]: http://search.yahoo.com/ "Yahoo Search" [3]: http://search.msn.com/ "MSN Search"

The output HTML is

I get 10 times more traffic from Google than from Yahoo or MSN.

[direct link]

Markdown supports a relatively short form of automatic links to deal with web addresses and email mailboxes. As long as it is wrapped in square brackets, Markdown will automatically convert it into a link with the same text as the link location.

[note] be sure to add http://, in front of the URL or it will not be recognized as URL

The output HTML is

Http://cnblogs.com/ Picture

The syntax of the picture is very similar to the link. First an exclamation point!, followed by a square bracket with the alternative text of the picture, followed by an ordinary parenthesis with the URL of the picture, and finally you can enclose it in quotation marks and add the optional 'title' text.

[in-line form]

! [alt text] (/ path/to/img.jpg "Title")

[reference form]

! [alt text] [id] [id]: / path/to/img.jpg "Title"

Both of the above methods output HTML as:

alt text

Code

[code]

Use backquotation marks to mark the code segment, and the & and within the section will be automatically converted into HTML entities

`

`paragraph'

`

The output HTML is

Paragraph

[pre]

If you want to create a formatted block of code, you just need to indent four spaces or one tab for each line, and &,

< 和 >

Will also be automatically converted to a HTML entity.

For example.

The output HTML is

For example.

Emphasize

Markdown uses asterisk * and bottom line _ as symbols to emphasize words. words surrounded by * or _ will be changed to be surrounded by tags, and if wrapped in two * or _, they will be converted to

If there are spaces on both sides of * and _, they will only be treated as ordinary symbols. If you want to insert a normal asterisk or underline directly before and after the text, you can use a backslash:

\ * em* strong*\ *

The output HTML is

Emstrong escape

In markdown, there are some symbols that have special uses, such as\, *, etc. If you want to use their original intention, you need to add a backslash\ to implement them.

Markdown supports the following symbols preceded by a backslash to help insert ordinary symbols

\ backslash `backquotation mark * asterisk _ bottom line {} curly brackets [] square brackets () brackets () brackets # pound sign + plus sign-minus sign. English full stop! The exclamation point is two empty.

When using markdown typesetting, a common requirement is to indent the first line, which is generally achieved by using two full-width spaces & emsp$emsp

Be careful

When using markdown to write a blog in the blog park, because there is no real-time display function, it is often parsed as

The situation

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report