Table of Contents
What?
Why?
How?
基本技巧
标题4
粗体和斜体
链接
列表
引用
图片
分隔符
表格
代码
参考文献
Home Web Front-end HTML Tutorial Markdown入门指南_html/css_WEB-ITnose

Markdown入门指南_html/css_WEB-ITnose

Jun 24, 2016 am 11:30 AM

What?

Markdown是一种轻量级的 「标记语言」,它的优点很多,目前也被越来越多的写作爱好者,撰稿者广泛使用。看到这里请不要被「标记」、「语言」所迷惑, Markdown的语法十分简单。常用的标记符号也不超过十个,这种相对于更为复杂的 HTML标记语言来说, Markdown是十分轻量的,学习成本也不需要太多,且一旦熟悉这种语法规则,会有一劳永逸的效果。

Why?

既然这种标记语言最终还要转换为 HTML文档格式,那么为什么我们还要使用它呢?有啥好处?

  1. 专注于你写作的内容本身,而不是排版样式。
  2. 可以导出 HTML、PDF 和本身的 .md 文件。
  3. 纯文本内容,兼容所有的文本编辑器与字处理软件。
  4. 随时修改你的文章版本,不必像字处理软件生成若干文件版本导致混乱。
  5. 可读、直观、学习成本低。

How?

基本技巧

标题

文章内容较多时,可以用标题分段:效果:

标题1

标题2

标题3

标题4

标题5

标题6

语法:

# 标题1## 标题2### 标题3#### 标题4##### 标题5###### 标题6
Copy after login

粗体和斜体

效果:

斜体文本

粗体文本

粗斜体文本

语法:

*斜体文本*  或者  _斜体文本_**粗体文本**   或者 __粗体文本__***粗斜体文本***  或者  ___粗斜体文本___
Copy after login

链接

常用链接方法

效果:

文字链接 Reeoo’s Blog

网址链接 http://reeoo.me

语法:

文字链接 [链接名称](http://链接网址)网址链接 <http://链接网址>
Copy after login

高级链接技巧

这个链接用 me作为网址变量 [ReeooMe][me]

这个链接用 co作为网址变量 [ReeooCo][co]

然后在文档的结尾为变量赋值(网址)

[me]: http://reeoo.me/[co]: http://reeoo.co/
Copy after login

效果:

ReeooMe

ReeooCo

列表

普通无序列表效果:

  • 列表项1
  • 列表项2
  • 列表项3语法:

    - 列表文本前使用 [减号+空格]+ 列表文本前使用 [加号+空格]* 列表文本前使用 [星号+空格]
    Copy after login

普通有序列表效果:

  1. 列表前使用 [数字+空格]
  2. 我们会自动帮你添加数字
  3. 不用担心数字不对,显示的时候我们会自动把这行的 7 纠正为 3

语法:

1. 列表前使用 [数字+空格]2. 我们会自动帮你添加数字7. 不用担心数字不对,显示的时候我们会自动把这行的 7 纠正为 3
Copy after login

引用

普通引用

> 引用文本前使用 [大于号+空格]> 折行可以不加,新起一行都要加上哦
Copy after login

效果:

引用文本前使用 [大于号+空格]折行可以不加,新起一行都要加上哦

引用里嵌套引用

语法:

> 最外层引用> > 多一个 > 嵌套一层引用> > > 可以嵌套很多层
Copy after login

效果:

最外层引用

多一个 > 嵌套一层引用

可以嵌套很多层

引用里嵌套列表

语法:

> - 这是引用里嵌套的一个列表> - 还可以有子列表> * 子列表需要从 - 之后延后四个空格开始
Copy after login

效果:

  • 这是引用里嵌套的一个列表
  • 还可以有子列表
    • 子列表需要从 - 之后延后四个空格开始

图片

跟链接的方法区别在于前面加了个感叹号 !,这样是不是觉得好记多了呢?

语法: ![图片名称](http://图片网址)当然,你也可以像网址那样对图片网址使用变量

这个链接用 me作为网址变量 [Reeoo's Blog][me].

然后在文档的结尾位变量赋值(网址)

[me]: http://img.reeoo.me/compass/add.jpg

分隔符

如果你有写分割线的习惯,可以新起一行输入三个减号-。当前后都有段落时,请空出一行:

写法:

前面的段落---后面的段落
Copy after login

效果:前面的段落

后面的段落

表格

表格是我觉得 Markdown比较累人的地方,例子如下:

| Tables        | Are           | Cool  ||:------------- |:-------------:| -----:|| col 3 is      | right-aligned | $1600 || col 2 is      | centered      |   $12 || zebra stripes | are neat      |    $1 |
Copy after login

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1

代码

如果你只想高亮语句中的某个函数名或关键字,可以使用 `function_name()` 实现( function_name())

通常编辑器根据代码片段适配合适的高亮方法,但你也可以用 ``` 包裹一段代码,并指定一种语言

$(function () {    console.log('reeoo.me');});
Copy after login

支持的语言: actionscript, apache, bash, clojure, cmake, coffeescript, cpp, cs, css, d, delphi, django, erlang, go, haskell, html, http, ini, java, javascript, json, lisp, lua, markdown, matlab, nginx, objectivec, perl, php, python, r, ruby, scala, smalltalk, sql, tex, vbscript, xml也可以使用 4 空格缩进,再贴上代码,实现相同的的效果

console.log('reeoo.me')
Copy after login

参考文献

  1. Markdown 编辑器语法指南
  2. Markdown——入门指南
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Mar 04, 2025 pm 12:32 PM

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

How to efficiently add stroke effects to PNG images on web pages? How to efficiently add stroke effects to PNG images on web pages? Mar 04, 2025 pm 02:39 PM

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

What are the best practices for cross-browser compatibility in HTML5? What are the best practices for cross-browser compatibility in HTML5? Mar 17, 2025 pm 12:20 PM

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

How do I use the HTML5 <time> element to represent dates and times semantically? How do I use the HTML5 <time> element to represent dates and times semantically? Mar 12, 2025 pm 04:05 PM

This article explains the HTML5 &lt;time&gt; element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

See all articles