一些markdown语句

网上摘抄的一些Mermaid

代码高亮

import functools
def ErrorCatch(func):
    """Print the error of the decorated function"""
    @functools.wraps(func)
    #等价于func=wrapper_timer(func)
    def wrapper_timer(*args, **kwargs):
        try:    
            func(*args, **kwargs)
        except Exception as e:
            print("Exception: %s: " %(e.args))
        else:
            print('try内没有异常')
    
    return wrapper_timer

#测试一下
@ErrorCatch
def waste_some_time(A):
    print(A[555])
    return 2

waste_some_time([0,1])

To-dolist

- [x] 已完成项目1

- [x] 已完成事项1

- [x] 已完成事项2

- [ ] 待办事项1

- [ ] 待办事项2

流程图

graph TB

  id1(圆角矩形)--普通线-->id2[矩形];
  subgraph 子图
   id2==粗线==>id3{菱形}
   id3-. 虚线.->id4>右向旗帜]
   id3--无箭头---id5((圆形))
  end
graph TB id1(圆角矩形)--普通线-->id2[矩形]; subgraph 子图 id2==粗线==>id3{菱形} id3-. 虚线.->id4>右向旗帜] id3--无箭头---id5((圆形)) end
graph LR;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
graph LR; A-->B; A-->C; B-->D; C-->D;
graph TD

A[christmas] -->B(Go shopping)

B --> C{LEt me think}

C -->|One| D[Laptop]

C -->|Two| E[iPhone]

C -->|Three|F[Car]
graph TD A[christmas] -->B(Go shopping) B --> C{LEt me think} C -->|One| D[Laptop] C -->|Two| E[iPhone] C -->|Three|F[Car]

序列图

sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John:hello John
    loop healthcheck
        John-->>John:fight against
    end
    Note right of John:rational
    
    John->>Alice:great!
    John->>Bob:how about you
    Bob->>John:good!
sequenceDiagram participant Alice participant Bob Alice->>John:hello John loop healthcheck John-->>John:fight against end Note right of John:rational John->>Alice:great! John->>Bob:how about you Bob->>John:good!
graph LR
    start[开始] --> input[输入A,B,C]
    input --> conditionA{A是否大于B}
    conditionA -- YES --> conditionC{A是否大于C}
    conditionA -- NO --> conditionB{B是否大于C}
    conditionC -- YES --> printA[输出A]
    conditionC -- NO --> printC[输出C]
    conditionB -- YES --> printB[输出B]
    conditionB -- NO --> printC[输出C]
    printA --> stop[结束]
    printC --> stop
    printB --> stop
graph LR start[开始] --> input[输入A,B,C] input --> conditionA{A是否大于B} conditionA -- YES --> conditionC{A是否大于C} conditionA -- NO --> conditionB{B是否大于C} conditionC -- YES --> printA[输出A] conditionC -- NO --> printC[输出C] conditionB -- YES --> printB[输出B] conditionB -- NO --> printC[输出C] printA --> stop[结束] printC --> stop printB --> stop
gantt         
       dateFormat  YYYY-MM-DD   
       title 使用mermaid语言定制甘特图

       section 任务1
       已完成的任务           :done,    des1, 2014-01-06,2014-01-08
       正在进行的任务               :active,  des2, 2014-01-09, 3d
       待完成任务1               :         des3, after des2, 5d
       待完成任务2              :         des4, after des3, 5d

       section 关键任务
       已完成的关键任务 :crit, done, 2014-01-06,24h
       已完成的关键任务2         :crit, done, after des1, 2d
       正在进行的关键任务             :crit, active, 3d
       待完成的关键任务        :crit, 5d
       待完成任务           :2d
       待完成任务2                      :1d

       section 文档编写
       描述甘特图语法               :active, a1, after des1, 3d
       完成甘特图实例1      :after a1  , 20h
       完成甘特图实例2    :doc1, after a1  , 48h
gantt dateFormat YYYY-MM-DD title 使用mermaid语言定制甘特图 section 任务1 已完成的任务 :done, des1, 2014-01-06,2014-01-08 正在进行的任务 :active, des2, 2014-01-09, 3d 待完成任务1 : des3, after des2, 5d 待完成任务2 : des4, after des3, 5d section 关键任务 已完成的关键任务 :crit, done, 2014-01-06,24h 已完成的关键任务2 :crit, done, after des1, 2d 正在进行的关键任务 :crit, active, 3d 待完成的关键任务 :crit, 5d 待完成任务 :2d 待完成任务2 :1d section 文档编写 描述甘特图语法 :active, a1, after des1, 3d 完成甘特图实例1 :after a1 , 20h 完成甘特图实例2 :doc1, after a1 , 48h
gantt title 这是个甘特图的栗子🌰 dateFormat MM-DD section 软件协同开发课程 项目启动 :done,des1,03-09,7d 项目计划 :done,des2,after des1,6d 需求分析 :done,des3,after des2,9d 软件设计 :done,des4,after des3,12d 软件编码 :crit,active,des5,04-07,20d 软件测试 :des6,04-14,15d 项目交付 :des7,after des6,4d
sequenceDiagram
    participant z as 张三
    participant l as 李四
    loop 日复一日
        z->>l: 吃了吗您呐?
        l-->>z: 吃了,您呢?
        activate z
        Note left of z: 想了一下
        alt 还没吃
            z-xl: 还没呢,正准备回去吃
        else 已经吃了
            z-xl: 我也吃过了,哈哈
        end
        opt 大过年的
            l-->z: 祝您新年好啊
        end
    end
sequenceDiagram participant z as 张三 participant l as 李四 loop 日复一日 z->>l: 吃了吗您呐? l-->>z: 吃了,您呢? activate z Note left of z: 想了一下 alt 还没吃 z-xl: 还没呢,正准备回去吃 else 已经吃了 z-xl: 我也吃过了,哈哈 end opt 大过年的 l-->z: 祝您新年好啊 end end

表格

pie

title Key elements in Product X
"Calcium" : 42.96
"Potassium" : 50.05
"Magnesium" : 10.01
"Iron" : 5
pie title Key elements in Product X "Calcium" : 42.96 "Potassium" : 50.05 "Magnesium" : 10.01 "Iron" : 5
journey
title My working day
section Go to work
Make tea: 5: Me
Go upstairs: 3: Me
Do work: 1: Me, Cat
section Go home
Go downstairs: 5: Me
Sit down: 3: Me
journey title My working day section Go to work Make tea: 5: Me Go upstairs: 3: Me Do work: 1: Me, Cat section Go home Go downstairs: 5: Me Sit down: 3: Me
erDiagram CUSTOMER ||--o{ORDER : places ORDER ||--|{LINE-ITEM : contains CUSTOMER}|..|{DELIVERY-ADDRESS : uses
stateDiagram [*]-->Active state Active { [*]-->NumLockOff NumLockOff-->NumLockOn : EvNumLockPressed NumLockOn-->NumLockOff : EvNumLockPressed -- [*]-->CapsLockOff CapsLockOff-->CapsLockOn : EvCapsLockPressed CapsLockOn-->CapsLockOff : EvCapsLockPressed -- [*]-->ScrollLockOff ScrollLockOff-->ScrollLockOn : EvCapsLockPressed ScrollLockOn-->ScrollLockOff : EvCapsLockPressed }
classDiagram Class01 <|-- AveryLongClass: Cool <<interface>> Class01 Class09-->C2: Where am i? Class09 --* C3 Class09 --|> Class07 Class07: equals() Class07: Object[] elementData Class01: size() Class01: int chimp Class01: int gorilla class Class10 { <<service>> int id size() }
gantt

section Section
Completed: done, des1, 2014-01-06, 2014-01-08
Active : active, des2, 2014-01-07, 3d
Parallel 1 : des3, after des1, 1d
Parallel 2 : des4, after des1, 1d
Parallel 3 : des5, after des3, 1d
Parallel 4 : des6, after des4, 1d
gantt section Section Completed: done, des1, 2014-01-06, 2014-01-08 Active : active, des2, 2014-01-07, 3d Parallel 1 : des3, after des1, 1d Parallel 2 : des4, after des1, 1d Parallel 3 : des5, after des3, 1d Parallel 4 : des6, after des4, 1d
sequenceDiagram

Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob : How about you?
Bob-->>John : Jolly good!
sequenceDiagram Alice->>John: Hello John, how are you? loop Healthcheck John->>John: Fight against hypochondria end Note right of John: Rational thoughts! John-->>Alice: Great! John->>Bob : How about you? Bob-->>John : Jolly good!
左对齐 右对齐 居中对齐
单元格 单元格 单元格

https://mermaid.js.org/syntax/flowchart.html

posted @ 2023-04-23 09:50  动量不守恒的浩  阅读(39)  评论(1编辑  收藏  举报