在stackoverflow上使用markdown

本文详细介绍了Markdown的基本语法,包括代码和预格式化文本、换行、斜体和粗体、链接、标题、水平分割线、列表、引用及图片插入等。此外还介绍了如何在Markdown中嵌入HTML代码以及StackOverflow特有的标签和代码高亮显示等功能。

stackoverflow流派的markdown。

Code and Preformatted Text

缩进四个空格,就可以写代码片段了

def hello():
    print "hello, world"

Linebreaks

在行尾添加个空格,就可以换行了

there is a space at the end 
another line

Italics and Bold

用下划线或星号包裹文本,就可以把它们变成斜体或粗体

_italics_
**bold**

用方括号包裹文本,把它变成链接

[this is a link](http://www.cnblogs.com)

Bare URLs

用尖括号包裹URL,也可以变成链接

<http://www.cnblogs.com>

Headers

在文本前面加井号,让它变成标题

# level one header
## level two header
### level three header

Horizontal Rules

用3+个减号,添加一个水平分割线

hello world

---

hello world

Simple lists

文字前加上数字或标点(减号,加号,星号),让它们变成列表

1. first item
2. second item
3. third item

- first item
- second item
- third item

Advanced lists: Nesting

列表可以嵌套喔

- first item
- second item
    * subitem 1
    * subitem 2
- third item

Simple blockquotes

在文本前加上大于号,表示引用

> hello world

Advanced blockquotes: Nesting

引用也可以嵌套喔

> hello kev
> nice to meet you
>> hi tom
>> nice to meet you too

Images

与链接语法类似,在最前面加个感叹号即可

![flair](https://i-blog.csdnimg.cn/blog_migrate/8a96706fe31353992f238d29d6c14104.png)

效果图:

flair

Inline HTML

也可以在文本中嵌入某些原生HTML代码

Type <kbd>:wq</kbd> to save and quit
I'm a **vim** user!!!

Stack Exchange additions (SO特有)

Tags

I'm a [tag:vim] user!

Spoilers

没用过这个功能 :(

Syntax highlighting for code

使用XML注释,指定语言种类

<!-- language: python -->

    def hello():
        print "hello, world"

Comment formatting

评论框中的Markdown有限制

_italic_ and **bold** text,
inline `code in backticks`,
and [basic links](http://example.com).

转载于:https://www.cnblogs.com/datageek/p/3862696.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值