Markdown syntax and common hexo commands

My blog has been up for a while, but I haven't written an article that organizes blog writing. Hexo uses Markdown to edit articles, and these articles I write are also done in this markup language. So, let's start with Markdown.


You can use the vim tool to directly edit the md file, you can also use Notepad to open the md file to edit the article, and of course you can also use the Markdown editor to write. I am a Mac system, so I use an editor called MacDown, I can edit on the left, and the preview can be given in real time on the right. It feels pretty good. First of all, let's first introduce what Markdown is.

What is Markdown

To quote from Wikipedia: Markdown is a lightweight markup language created by John Gruber and Aaron Swartz. It allows people to "write documents in a plain text format that is easy to read and write, and then convert them into valid XHTML documents".

Markdown syntax

1. Title setting

There are two ways to set the title in Markdown:

  1. By adding "=" and "-" below the text, they represent the primary and secondary headings, respectively.
  2. Add "#" at the beginning of the text, and indicate several levels of headings by the number of "#". (There are only 1 to 6 titles in total, and the font of the 1 title is the largest)
2. Block comments

Block comments are indicated by adding a ">" at the beginning of the text. (When five blanks are added between > and the text, the text of the block comment changes.)

3, italics

Use a "*" or "_" at both ends of the text that needs to be italicized

4. Bold

Use 2 "*" or "_" at both ends of the text that needs to be italicized

5. No need for a list

Add (*, +, and -) at the beginning of the text to implement an unordered list. But note that spaces need to be added between (*, +, and -) and the literal. (suggestion: just use an unordered list representation in a document)

6. Ordered list

Use a number followed by a period. (also with spaces)

There are two ways to implement links in Markdown, namely inline and reference.
Inline way:

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

Citation:

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"
8. Images

The way images are handled is very similar to the way links are handled.
Inline way:

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

Citation:

![alt text][id]
[id]: /path/to/img.jpg "Title"
9. Code (so-called Code in HTML)

There are two implementations:

The first: a code box appears for simple text. Use a ` around the code.

The second type: large pieces of text need to implement code boxes. Use Tab and four spaces.

10. Underscore

Add three "-" dashes below the blank line. (As mentioned earlier, adding "-" below the text to achieve a level 2 title)

For more information on the usage of Markdown, please refer to the official website of Markdown:
http://daringfireball.net/projects/markdown/

Hexo common commands

To update your blog in a configured environment, you need to use some commands of hexo. Fortunately, the hexo commands are relatively simple, so people can focus more on the writing of the article. Below are some commonly used commands.

1. New
hexo new "my blog"

The new file is in hexo/source/_posts/my-blog.md

2. Compile
hexo generate

Generally, you need to compile it when you deploy it. After compiling, a public folder will appear, and all md files will be compiled into html files.

3. Start local service
hexo server

This command is used to start the local hexo service. After running, log in to the local localhost:4000 directly with the browser to see the locally deployed blog.

4. Deployment
hexo deploy

When deploying to git, you need to use this command.

5. Clear public
hexo clean

When some resources in the source folder are changed, especially after the file is deleted or the path is changed, you need to execute this command and then recompile.

Finally, it is worth mentioning that the hexo command does not need to spell out all the words when using it, for example, it can hexo dbe deployed directly to git.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324603429&siteId=291194637