当前位置:网站首页>How to write mark down on vscode

How to write mark down on vscode

2022-07-08 01:03:00 Sleepy without water

How to be in VSCode Write on Mark Down

   In recent years Markdown This kind of lightweight text editing is very popular , Although it cannot replace what we are still using word, But many creation platforms have put Markdown File format into the platform , This means that in the future, you can write blogs and official account directly in Markdown Finish writing on , Then switch to the creation platform on the third-party platform , For example, Jane book ,CSDN, official account 、 You know , All of these can be used Markdown The grammar of .
 Insert picture description here

   know Markdown After being so strong , I began to work on Markdown There is something written on it , It's also very comfortable to use . Here's how to share VSCode Upper use Markdown.

   I have been using it for some time Markdown The software is typora, Not long ago, the official website just announced the charge , What a pity it is , As a white whoring party , I went to search the others Markdown Writing software , Tried a lot , such as MacdownMarxicoAtomMWeb, Etc., etc. , Finally, I compared them , Or choose VSCode, If for no other , Just like , Now many software are VSCode Plug ins are available on ,VSCode It has also become an essential writing software on my computer .

   stay VSCode Write on Markdown file , It's really easy , Only one plug-in is needed 【Markdown All in one】 , After installation, it can be used directly .

   The premise is that you should install VSCode, And adapt to the Chinese language environment .

   Next, let's talk about writing Markdown Some commonly used grammars , Grammar is also very simple , Some will , There are many super long tutorials on the Internet , No need at all , You can learn by reading an article . Let me list what I'm writing Markdown Grammar often used when .

The writing of the text

Normal paragraph text

Common paragraphs and use word Writing is no different , Write directly . Such as :

 Olympic Games , It is the world's largest comprehensive Games hosted by the International Olympic Committee , Every four years , The duration of the meeting does not exceed 16 Japan , It is the most influential sports event in the world .

In an article, there can be more than one sentence in a paragraph , Use a full stop in the sentence , question mark , Exclamation point and so on , And a paragraph ends with a carriage return .

Italics 、 bold 、 Delete line

Highlight key words in the article , Sentences can be tilted , Bold, etc ,word Text to be selected in , Then give the style , and markdown Just add * No. 1 is enough .

Add one at the front and one at the back * Number , The text will tilt :

* Italics * The final effect is Italics

Add two before and after * Number , The text will be bold :

** bold ** The final effect is bold

Add two before and after ~ Number , A strikethrough appears in the text , This is a reverse emphasis , Express “ Should not be ”,“ Incorrect ” Wait, what do you mean :

~~ Delete ~~ The final effect is Delete

The following table lists the effects of all special symbols

grammar effect
* Italics 1* Italics 1
_ Italics 2_ Italics 2
** bold 1** bold 1
__ bold 2__ bold 2
~~ Delete line ~~ Delete line
*** Oblique bold 1*** Oblique bold 1
___ Oblique bold 2___ Oblique bold 2
***~~ Obliquely bold strikeouts 1~~*** Obliquely bold strikeouts 1
~~*** Obliquely bold strikeouts 2***~~ Obliquely bold strikeouts 2

Italics 、 bold 、 Strikeouts can be mixed .
Aforementioned *,_,~ These symbols are English symbols , Less used in Chinese environment , So there will be no problem to mark the special format , If you want to use the above symbols , Please take the first one \, such as \* The end result is *.

The advantage of using this way of adding symbols before and after to mark special formats is that it is faster , Easy to modify , And it's readable text , stay markdown These symbols in the editor will be converted to format , What ordinary text editors see is symbols , It will not affect the reading content .

Scarlet text

The scarlet text is leaner than , Bold more eye-catching style ,word Text is usually selected , Then click font color .markdown Middle is to add one before and one after the text to be marked in red ``` Symbol , The method is the same as the tilt described above , Bold :

The scarlet letter The final effect is the scarlet letter

The scarlet letter can also be in italics , bold , Strikethrough mixed use . Such as * Tilt the scarlet letter * The final effect is Tilt the scarlet letter .
markdown Set different font colors only ``` A symbol , The default is red , But you can use css Set to other colors , Like blue , green , But there is only one heterochromatic effect .

title

markdown Add #, Set it as the title . One # It's the first level title , Two # It's a secondary title , There can be six levels of titles .

grammar effect
# First level title First level title
## Secondary title Secondary title
### Three level title Three level title
#### The fourth level title The fourth level title
##### Five level titles Five level titles
###### Six level title Six level title

As the most common primary title and secondary Title , It can also be written in another way , Add three under the first level Title ( Or more ) Successive = Number , Add three under the secondary Title ( Or more ) Successive - Number :

grammar effect
First level title === First level title
Secondary title --- Secondary title

Note that the text format is different from that described above , There is no need to add a special symbol at the beginning and end of the title , Just add # That's all right. , And it must be at the beginning of the line .
The title is the same as ordinary text , The text inside can also be written in red , Italics , bold , Delete line . But the general style of the title is bold , It can't be distinguished with bold eyes .

How to write pictures

Use the following format to insert pictures into the article :

![ Picture name ]( Image file path )

The picture name can be omitted . The image file path can be an absolute path , Such as C:\Windows\Greenstone.bmp. If the pictures and articles are in the same directory , You can also have only the file name . for example :

![ Athletics ]( Athletics .jpg)

Something like mini markdown The editor can directly drag the image file into the article , You can also paste picture files , Picture data . If you are pasting image data , A picture file will be automatically created in the management directory of the editor to save data , And insert it into the article with the above picture format .

How to write links

Use the following format to insert links in the article :

[ Link name ](URL Or file path )

for example [Google](https://www.google.com), Click here Google Will jump to Google Its official website .

Compare with the previous picture , You can see the difference ? The answer is that there is no exclamation point in front of the link .
Links can also be associated with the scarlet letter , Italics , bold , Delete lines and other mixed use , It can also be used in the title .

Link local files

In addition to the URL , You can also link local files , for example [ Green stone ](C:\Windows\Greenstone.bmp), Pay attention to the difference between adding an exclamation point and not adding an exclamation point , Adding an exclamation mark will treat it as a picture , If it is the image format supported by this software , It will be displayed in the article ; Without an exclamation mark, it will be treated as a link , Clicking it will open the file location . The file path can be absolute , It can also be the relative path of the article .

Link to other articles

By linking other articles , You can jump between articles . For example, articles A A topic in the article B There is a more detailed discussion in , Can be in the article A Use a jump to the article B Link to , The same format as the previous link local file , for example :[ What is? markdown](what_is_markdown.html).

Paragraph anchor

By adding # Paragraph name , You can jump to the specified paragraph of the article . The paragraph name is the title of this paragraph , It can be a primary title , Secondary title , Up to the sixth level Title .

If you want to jump to the anchor point in this article , The article name can be omitted , for example [ Jump to the introduction of the title in this article ](# title ).

The paragraph anchor can be any level of Title , If there are two titles with the same name in the article , Then only the previous one can be set as an anchor , Clicking it will only jump to the previous paragraph .

The following will introduce the list , form , Code segment , How to write a quotation .

How to write the separation line

Separator line is a kind of element that is widely used in webwriting , The meaning that can be expressed is supplemented by the article , Reference source , Signature, etc. , stay word in , You can enter three in the blank line -, Or three =, Or three ~ wait , Then press enter to insert the separation line .markdown Is the same , Just type three or more in a row *-_ You can draw a horizontal line in the article :

grammar effect
***
---
___

Word The separation line in depends on different symbols , It can be linear , Double linear , Wave pattern, etc ,markdown There is only one , But you can use css Set the line type .

How to write a quotation

Quote famous people , Or the words of others in other articles , It is usually placed in a reference segment .word You can select the reference type when selecting the style , and markdown It is also convenient to create reference segments , Just start the paragraph with a <+ Just start with a space .

grammar effect
< The Olympic Games originated in ancient Greece more than 2000 years ago , It is named after the place where it is held in Olympia . The ancient Olympic Games have been suspended 1500 Years later, , French Coubertin in 19 The proposal of holding modern Olympic Games was put forward at the end of the century .1894 The Olympic Committee was established in ,1896 The first Olympic Games was held in ,1924 The first winter Olympics was held in ,1960 The first Paralympic Games was held in ,2010 The first Youth Olympic Games was held in ,2012 The first Qingdao Winter Olympics was held in . The Olympic Games originated in ancient Greece more than 2000 years ago , It is named after the place where it is held in Olympia . The ancient Olympic Games have been suspended 1500 Years later, , French Coubertin in 19 The proposal of holding modern Olympic Games was put forward at the end of the century .1894 The Olympic Committee was established in ,1896 The first Olympic Games was held in ,1924 The first winter Olympics was held in ,1960 The first Paralympic Games was held in ,2010 The first Youth Olympic Games was held in ,2012 The first Qingdao Winter Olympics was held in .

Quotation paragraphs are also text paragraphs , Various text formats introduced in the previous article , picture , Links and so on can also be used in reference segments , And you can use css Set different display styles .

How to write a list

If multiple paragraphs are juxtaposed , It can be presented in the form of a list , Appear cleaner . stay markdown in , Each successive paragraph begins with a *+ A list is formed at the beginning of the space .

grammar effect
* Athletics : Track and field is the oldest sport in sports . * Rowing : A rowing sport in which athletes row with their backs in the forward direction . * Bicycle : Originated in Europe .1896 Listed as the first Olympic Games in . Athletics : Track and field is the oldest sport in sports . Rowing : A rowing sport in which athletes row with their backs in the forward direction . Bicycle : Originated in Europe .1896 Listed as the first Olympic Games in .

If multiple paragraphs are juxtaposed , And logically, there is a sequential relationship , It can be presented in the form of a sequence table . and word equally , Each successive paragraph begins with a number +.+ A sequence table is formed at the beginning of the space .

grammar effect
1. Athletics :47 Gold MEDALS 2. swimming :44 Gold MEDALS 3. Bicycle :18 Gold MEDALS Athletics :47 Gold medal swimming :44 Gold medal bicycle :18 Gold MEDALS

and word equally , The number at the beginning of the paragraph does not need to be continuous , For example, three paragraphs are marked with 1.1.1. start , Or separately 1.3.5. start , The final effect is 1.2.3. The serial number of ,markdown It will automatically calculate the serial number of the list .

If an item in the list can continue to expand , Other lists can also be embedded , That is, multi-level list . Just add three spaces at the beginning of the above two paragraphs ,word Is very similar .

grammar effect
1. Athletics :47 Gold MEDALS 2. swimming :44 Gold MEDALS 1. Swimming in the swimming lane :34 Gold MEDALS 2. diving :8 Gold MEDALS 3. Synchronized Swimming :2 Gold MEDALS 3. Bicycle :18 Gold MEDALS 1. A mountain country :2 Gold MEDALS 2. highway :4 Gold MEDALS 3. site :10 Gold MEDALS 4. BMX Cycling BMX :2 Gold MEDALS Athletics :47 Gold medal swimming :44 Gold medal swimming lane :34 Gold medal diving :8 Gold Medal Synchronized Swimming :2 Gold medal bicycle :18 Gold medal mountain :2 Gold road :4 Gold medal venue :10 Gold MEDALS BMX Cycling BMX :2 Gold MEDALS

The list segment is also a text segment , Various text formats introduced in the previous article , picture , Links and so on can also be used in list segments , And you can use css Set different display styles .

How to write a table

markdown Complex tables are not directly supported in , It's usually m That's ok *n Ordinary table of columns , There can be a header , That is to say (m data row +1 Header row )*n Column . The practice is also similar to word Very different in , It's through | Characters and - character “ draw ” form . For example, the following character table :

| Number of sessions   | The name of the event        | Host country | host city | Time               |
|------|----------------|---|---|---------------------|
| The first 01 the |1896 Athens Olympic Games | The Greek | Athens |1896 year 04 month 06 Japan -1896 year 04 month 15 Japan |
| The first 02 the |1900 The Paris Olympics | The French | In Paris, |1900 year 05 month 20 Japan -1900 year 10 month 28 Japan |
| The first 03 the |1904 St. Louis Olympic Games | The United States | St. Louis |1904 year 07 month 01 Japan -1904 year 11 month 23 Japan |
| The first 04 the |1908 The London Olympics | The British | The British |1908 year 04 month 27 Japan -1908 year 10 month 31 Japan |
					

The following table will be created :

Number of sessions The name of the event Host country host city Time
The first 01 the 1896 Athens Olympic Games The Greek Athens 1896 year 04 month 06 Japan -1896 year 04 month 15 Japan
The first 02 the 1900 The Paris Olympics The French In Paris, 1900 year 05 month 20 Japan -1900 year 10 month 28 Japan
The first 03 the 1904 St. Louis Olympic Games The United States St. Louis 1904 year 07 month 01 Japan -1904 year 11 month 23 Japan
The first 04 the 1908 The London Olympics The British The British 1908 year 04 month 27 Japan -1908 year 10 month 31 Japan

| Characters and - The characters represent the vertical and horizontal edges of the table respectively , One of the horizontal side as long as the first line below it , The first line is the header . And there is no need to align neatly , Just remember that a vertical line separates one cell .

Align the table in the second row , That is pure | Characters and - A header composed of characters / Table data separated row control , If a cell is in : Starts with : ending , Then this column is centered , Only with : The beginning is left aligned , Only with : The end is right aligned , for example :

|  Align left  |  In the middle   |  Right alignment  |
| :------------ |:---------------:| -----:|
| col 3 is      | some wordy text | $1600 |
| col 2 is      | centered        |   $12 |
| zebra stripes | are neat        |    $1 |
					

The following table will be created :

Align left In the middle Right alignment
col 3 issome wordy text$1600
col 2 iscentered$12
zebra stripesare neat$1

If a cell is not aligned , No : character , Then this column is the default alignment , from css Set up , Usually left aligned .

Finally, let's talk about another common form , There is no meter , All consist of data , That is, headless tables . A headless table is a cell in the first row that cannot contain characters other than spaces , For example, just delete the table above “ Align left ”,“ In the middle ”,“ Right alignment ”:

|  |   |  |
| :------------ |:---------------:| -----:|
| col 3 is      | some wordy text | $1600 |
| col 2 is      | centered        |   $12 |
| zebra stripes | are neat        |    $1 |
					

The following table will be created :

col 3 issome wordy text$1600
col 2 iscentered$12
zebra stripesare neat$1

Various text formats introduced in the previous article can be used in both the header unit and the data unit , picture , link , And you can use css Set different display styles .

How to write the code segment

When programmers write technical articles, they usually insert paragraph by paragraph of code , The code snippet is in word There is no direct way to deal with it , And in the markdown Medium is very convenient , By two by three ``` character ( The quotation marks , On the keyboard Esc Below health , Numbers 1 The key on the left ) The part of the package is the program code , Such as :

grammar effect
int main(int argc, char *argv[]) { printf("Hello, world!\n"); }int main(int argc, char *argv[]){ printf("Hello, world!\n");}

Usually markdown The editor also allows you to set the syntax of code snippets , For example, common C++JavaPython wait , Mini You can set more than 30 grammars , After setting the syntax, you can display the syntax information in the code :

grammar effect
````c++` int main(int argc, char *argv[]) { printf(“Hello, world!\n”); } `````int main(int argc, char *argv[]){ printf("Hello, world!\n");}

You cannot use various text formats of an introduction in a code segment , picture , link , All text is direct text .

markdown All the basic writing methods of are introduced , In the future, more extended writing methods will be introduced .

   The above is that I am writing official account and Zhihu , Frequently used Markdown grammar , It's really easy to use , Recommended for everyone , We can Markdown Use it as a text editor , Write some programs on the computer , Or some ideas when writing a paper , They are all very good . With some Markdown Charge for writing software , I believe that after VSCode Will be more popular .
 Insert picture description here

原网站

版权声明
本文为[Sleepy without water]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130551018042.html