Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Markdown Tutorial

Markdown Tutorial

Markdown is a lightweight markup language that allows people to write documents using an easy-to-read, easy-to-write plain-text format.

The Markdown language was created in 2004 by John Gruber (English: John Gruber).

Markdown's design philosophy is 'easy to read, easy to write,' enabling people to use a simple plain-text format to write structured documents.

Documents written in Markdown can be exported to many formats such as HTML, Word, images, PDF, and EPUB.

Documents written in Markdown use the extensions .md and .markdown.


Markdown's core features include:

simplicity: Uses intuitive symbols to represent formatting, for example, using # to represent headings and * to represent list items. These symbols convey their meaning visually and remain readable even without rendering.

Readability: Even a plain-text Markdown document clearly shows the structure and hierarchy of the content. Readers can understand how the content is organized without specialized software.

Portability: Markdown files are in plain-text format and can be opened and edited in any text editor, without depending on specific software or an operating system.

Convertibility: It can be easily converted to HTML, PDF, Word documents, and other formats to meet different publishing needs.


The concept of lightweight markup languages

A markup language is a language that uses specific symbols to describe the structure and formatting of a document. Traditional markup languages like HTML are powerful but have complex syntax, whereas lightweight markup languages simplify this process.

Compared with HTML, Markdown's advantages are:


The relationship between Markdown and HTML

Markdown is not a replacement for HTML but a simplified version of it. In fact, Markdown's ultimate goal is to be converted to HTML. The relationship between the two can be understood as follows:

Markdown 源码 → 解析器 → HTML 输出 → 浏览器渲染

For example, when you write:

# 这是一个标题

It will be converted to:

这是一个标题

Importantly, in Markdown you can directly use HTML tags, which provides flexibility for complex formatting. When Markdown's basic syntax cannot meet your needs, you can embed HTML code to achieve specific effects.


Why choose Markdown

Improve writing efficiency: No need to frequently use the mouse for formatting, allowing you to maintain a continuous flow of thought. Writers can focus on content creation without being distracted by formatting issues.

Lower the learning barrier: Compared with markup languages such as LaTeX and HTML, Markdown's syntax is extremely simple, and most people can master the basics within an hour.

Broad compatibility: Almost all modern text editors, code editors, and note-taking apps support Markdown. From a simple Notepad to a professional IDE, you can find Markdown everywhere.

Version-control friendly: Because it is plain text, Markdown files work well with version control systems such as Git, making it easy to track document change history and collaborate as a team.

Future adaptability: Even if specific software or platforms disappear, Markdown files as plain text can still be accessed and edited, ensuring the long-term availability of the content.


Markdown use cases

Technical documentation authoring

In software development, Markdown has become the standard format for technical documentation. It is especially suitable for:

Blog post writing

Most modern blogging platforms and static site generators support Markdown:

GitHub README files

The GitHub platform widely uses Markdown, especially for project README files:

Note-taking and knowledge management

Markdown is becoming the preferred format for digital notes:

Online writing platforms

More and more writing platforms are beginning to support Markdown:


Useful books

The book 'The Amazing Markdown':