zoukankan      html  css  js  c++  java
  • markdown语法学习效果预览

    注: 结合markdown官方文档 其中大部分例子和说明文字都摘自官方文档
    官方链接:Markdown: Basics (快速入门)

    一 段落、标题、区块代码

    Markdown 支持两种标题的语法,Setext 和 atx 形式。
    Setext 形式是用底线的形式,利用 = (最高阶标题)和 - (第二阶标题),
    Atx 形式在行首插入 1 到 6 个 # ,对应到标题 1 到 6 阶。

    区块引用则使用 email 形式的 '>' 角括号。

    A First Level Header

    A Second Level Header

    Now is the time for all good men to come to
    the aid of their country. This is just a
    regular paragraph.

    The quick brown fox jumped over the lazy
    dog's back.

    Header 3

    This is a blockquote.

    This is the second paragraph in the blockquote.

    This is an H2 in a blockquote

    以上是markdown给出的官方例子,由此可看出:

    • 特殊符号‘#’、‘>’后面需要有一个空格
    • 段落是用空行来分隔的

    二 修辞和强调

    Markdown 使用星号和底线来标记需要强调的区段。

    Markdown 语法:

    Some of these words are emphasized.
    Some of these words are emphasized also.
    Use two asterisks for strong emphasis.
    Or, if you prefer, use two underscores instead.

    斜体加粗的强调

    三 列表

    无序列表使用星号、加号和减号来做为列表的项目标记,这些符号是都可以使用的,

    星号:

    • Candy.
    • Gum.
    • Booze.

    加号:

    • Candy.
    • Gum.
    • Booze.

    减号:

    • Candy.
    • Gum.
    • Booze.

    有序的列表则是使用一般的数字接着一个英文句点作为项目标记:

    1. Red
    2. Green
    3. Blue

    也可以在一个项目内放上多个段落,只要在它前面缩排 4 个空白或 1 个 tab :

    • A list item.

      With multiple paragraphs.

    • Another item in the list.

    四 链接

    Markdown 支援两种形式的链接语法: 行内 和 参考 两种形式,两种都是使用角括号来把文字转成连结。

    • 行内形式是直接在后面用括号直接接上链接:

      This is an example link.

      也可以选择性的加上 title 属性:

      This is an example link.

    • 参考形式的链接让你可以为链接定一个名称,之后你可以在文件的其他地方定义该链接的内容:

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

    title 属性是选择性的,链接名称可以用字母、数字和空格,但是不分大小写:

    I start my morning with a cup of coffee and
    The New York Times.

    五 图片

    图片的语法和链接很像。

    • 行内形式(title 是选择性的):

      alt text

    • 参考形式:

      alt text

    六 代码

    在一般的段落文字中,你可以使用反引号 ` 来标记代码区段,
    如果要建立一个已经格式化好的代码区块,只要每行都缩进 4 个空格或是一个 tab 就可以了。

    Markdown 语法:

    使用tab或空格:

    # -*- coding: utf-8 -*-
    
    from functools import reduce
    
    def not_empty(str1):
        return str1 and str1.strip()
    
    def not_empt(s):
        return s.strip() and s
    
    s1 = ['A', '', 'B', None, 'C', '  ','abc']
    print(list(filter(not_empty, s1)))
    print(list(filter(not_empt, s1)))
    

    使用反引号:

    # -*- coding: utf-8 -*-
        
    from functools import reduce
        
    def not_empty(str1):
        return str1 and str1.strip()
    
    def not_empt(s):
        return s.strip() and s
    
    s1 = ['A', '', 'B', None, 'C', '  ','abc']
    print(list(filter(not_empty, s1)))
    print(list(filter(not_empt, s1)))
    
    转载请注明出处!转载请注明出处!转载请注明出处!
  • 相关阅读:
    第一节:SpringMVC概述
    SpringMVC【目录】
    Windows 系统快速查看文件MD5
    (error) ERR wrong number of arguments for 'hmset' command
    hive使用遇到的问题 cannot recognize input
    Overleaf支持的部分中文字体预览
    Understanding and Improving Fast Adversarial Training
    Django2实战示例 第十三章 上线
    Django2实战示例 第十二章 创建API
    Django2实战示例 第十一章 渲染和缓存课程内容
  • 原文地址:https://www.cnblogs.com/christsong/p/5500748.html
Copyright © 2011-2022 走看看