Markdown简介

markdown

Posted by huajh7 on April 4, 2017
  • 功能丰富 :支持高亮代码块、LaTeX 公式、流程图,本地图片以及附件上传,甚至截图粘贴,工作学习好帮手;

Markdown简介

Markdown 是一种轻量级标记语言,它允许人们使用易读易写的纯文本格式编写文档,然后转换成格式丰富的HTML页面。 —— 维基百科

正如您在阅读的这份文档,它使用简单的符号标识不同的标题,将某些文字标记为粗体或者斜体,创建一个链接或一个脚注1。下面列举了几个高级功能,更多语法请按Ctrl + /查看帮助。

代码块

using molokai.css by rougify style molokai > css/syntax.css

Add the code in syntax.css to change the font and font-size

.highlight {
  color: #F5F5F5;
  background-color: #272822;  /*#1b1d1e  f8f8f2  272822*/
  font-family: 'Consolas', serif;
  font-size: 15px;  
}
@requires_authorization
def somefunc(param1='', param2=0):
    '''A docstring'''
    if param1 > param2: # interesting
        print 'Greater'
    return (param2 - param1 + 1) or None
class SomeClass:
    pass
>>> message = '''interpreter
... prompt'''

ruby

def show
  @widget = Widget(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @widget }
  end
end

matlab

A = cat( 3, [1 2 3; 9 8 7; 4 6 5], [0 3 2; 8 8 4; 5 3 5], ...
                 [6 4 7; 6 8 5; 5 4 3]);
% The EIG function is applied to each of the horizontal 'slices' of A.
for i = 1:3
    eig(squeeze(A(i,:,:)))
end

python

class ReqStrSugRepr(type):

    def __init__(cls, name, bases, attrd):
        super(ReqStrSugRepr, cls).__init__(name, bases, attrd)

        if '__str__' not in attrd:
            raise TypeError("Class requires overriding of __str__()")

        if '__repr__' not in attrd:
            warn(
                'Class suggets overrding of __repr__()\n',
                stacklevel=3)

c/c++

int main()
{
    int a = 10;
    print("int a = %d\n", a);
}

java

import JavaBeans.People.Administor;

public class AcceptMember extends HttpServlet {
    /**
     * 
     * @throws ServletException if an error occurred
     * @throws IOException if an error occurred
     */
    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        response.setContentType("text/html");
        doPost(request, response);
    }
}


LaTeX 公式

可以创建行内公式,例如 \(\Gamma(n) = (n-1)!\quad\forall n\in\mathbb N\)。或者块级公式:

\[x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}\]

表格

First cell Second cell Third cell  
First Second Third  
First Second   Fourth
Item Value Qty
Computer 1600 USD 5
Phone 12 USD 12
Pipe 1 USD 234

流程图

st=>start: Start
e=>end
op=>operation: My Operation
cond=>condition: Yes or No?

st->op->cond
cond(yes)->e
cond(no)->op

以及时序图:

Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!

提示:想了解更多,请查看流程图语法以及时序图语法

复选框

使用 - [ ]- [x] 语法可以创建复选框,实现 todo-list 等功能。例如:

  • 已完成事项
  • 待办事项1
  • 待办事项2

注意:目前支持尚不完全,在印象笔记中勾选复选框是无效、不能同步的,所以必须在马克飞象中修改 Markdown 原文才可生效。下个版本将会全面支持。

质能方程公式:\(E=mc^2\)

\[\min_{x,y} \sum_{i=1}^{N} (x_i+ 10 + y_i)^2\]

脚注(footnote)

实现方式如下:

比如PHP2 Markdown Extra 3 是这样的。

引用方式:

I get 10 times more traffic from Google than from Yahoo or MSN.

下划线

—下划线—

Images

内联方式:

lenaNoise

引用方式:

alt text

反馈与建议


感谢阅读这份帮助文档。请点击右上角,绑定印象笔记账号,开启全新的记录与分享体验吧。

  1. 这是一个示例脚注。请查阅 MultiMarkdown 文档 关于脚注的说明。 限制: 印象笔记的笔记内容使用 ENML 格式,基于 HTML,但是不支持某些标签和属性,例如id,这就导致脚注TOC无法正常点击。 

  2. Markdown是一种纯文本标记语言 

  3. 开源笔记平台,支持Markdown和笔记直接发为博文