热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

typora绘图(时序、类图等)

转载于官网:https:support.typora.ioDraw-Diagrams-With-MarkdownDrawDiagramsWithMarkdownAu

转载于官网:https://support.typora.io/Draw-Diagrams-With-Markdown/

Draw Diagrams With Markdown

August 15, 2016 by typora.io


  • Sequence Diagrams
    • Sequence Diagrams Options
  • Flowcharts
  • Mermaid
    • Sequence Diagrams
    • Flowcharts
    • Gantt Charts
    • Class Diagrams
    • State Diagrams
    • Pie Charts
    • Mermaid Options
      • Overview
      • Mermaid Theme
      • Auto Numbering
      • Flowchart Curve
      • Gantt Padding

Typora supports some Markdown extensions for diagrams, once they are enabled from preference panel.

When exporting as HTML, PDF, epub, docx, those rendered diagrams will also be included, but diagrams features are not supported when exporting markdown into other file formats in current version. Besides, you should also notice that diagrams is not supported by standard Markdown, CommonMark or GFM. Therefore, we still recommend you to insert an image of these diagrams instead of write them in Markdown directly.


Sequence Diagrams

This feature uses js-sequence, which turns the following code block into a rendered diagram:

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

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-bSA1rqnW-1623159244922)(https://support.typora.io/media/diagrams/js-sequence.png)]

For more details, please see this syntax explanation.


Sequence Diagrams Options

You could change CSS variable --sequence-theme to set theme for sequence diagrams, supported value are simple (default) and hand. For example, add following CSS in Custom CSS, and you will get:

:root {--sequence-theme: hand
}

–sequence-theme: simple–sequence-theme: hand
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-F9miOR0x-1623159244933)(https://support.typora.io/media/diagrams/Screen%20Shot%202021-04-05%20at%2023.38.52.png)]Screen Shot 2021-03-13 at 23.56.07

Flowcharts

This feature uses flowchart.js, which turns the following code block into a rendered diagram:

```mermaid
flowchat
st=>start: Start
op=>operation: Your Operation
cond=>condition: Yes or No?
e=>endst->op->cond
cond(yes)->e
cond(no)->op
```

flowchart


Mermaid

Typora also has integration with mermaid, which supports sequence diagrams, flowcharts, Gantt charts, class and state diagrams, and pie charts.


Sequence Diagrams

For more details see these instructions.

```mermaid
%% Example of sequence diagramsequenceDiagramAlice->>Bob: Hello Bob, how are you?alt is sickBob->>Alice: Not so good :(else is wellBob->>Alice: Feeling fresh like a daisyendopt Extra responseBob->>Alice: Thanks for askingend
```

mermaid-sequence


Flowcharts

For more details see these instructions.

```mermaid
graph LR
A[Hard edge] -->B(Round edge)B --> C{Decision}C -->|One| D[Result one]C -->|Two| E[Result two]
```

mermaid-flowchart


Gantt Charts

For more details see these instructions.

```mermaid
%% Example with selection of syntaxesganttdateFormat YYYY-MM-DDtitle Adding GANTT diagram functionality to mermaidsection A sectionCompleted task :done, des1, 2014-01-06,2014-01-08Active task :active, des2, 2014-01-09, 3dFuture task : des3, after des2, 5dFuture task2 : des4, after des3, 5dsection Critical tasksCompleted task in the critical line :crit, done, 2014-01-06,24hImplement parser and jison :crit, done, after des1, 2dCreate tests for parser :crit, active, 3dFuture task in critical line :crit, 5dCreate tests for renderer :2dAdd to mermaid :1dsection DocumentationDescribe gantt syntax :active, a1, after des1, 3dAdd gantt diagram to demo page :after a1 , 20hAdd another diagram to demo page :doc1, after a1 , 48hsection Last sectionDescribe gantt syntax :after doc1, 3dAdd gantt diagram to demo page : 20hAdd another diagram to demo page : 48h
```

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-kfOarutF-1623159244968)(https://support.typora.io/media/diagrams/mermaid-Gantt-chart.png)]


Class Diagrams

For more details see these instructions.

```mermaid
classDiagramAnimal <|-- DuckAnimal <|-- FishAnimal <|-- ZebraAnimal : &#43;int ageAnimal : &#43;String genderAnimal: &#43;isMammal()Animal: &#43;mate()class Duck{&#43;String beakColor&#43;swim()&#43;quack()}class Fish{-int sizeInFeet-canEat()}class Zebra{&#43;bool is_wild&#43;run()}
&#96;&#96;&#96;

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tzJ8rNdp-1623159244971)(https://support.typora.io/media/new-80/class-diagram.png)]


State Diagrams

For more details see these instructions.

&#96;&#96;&#96;mermaid
stateDiagram[*] --> StillStill --> [*]Still --> MovingMoving --> StillMoving --> CrashCrash --> [*]
&#96;&#96;&#96;

state-diagram


Pie Charts

&#96;&#96;&#96;mermaid
pietitle Pie Chart"Dogs" : 386"Cats" : 85"Rats" : 150
&#96;&#96;&#96;

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HbfKvNUY-1623159244981)(https://support.typora.io/media/new-80/pie-chart.png)]


Mermaid Options


Overview

You can change Mermaid options by adding Custom CSS, supported options include:

:root {--mermaid-theme: default; /*or base, dark, forest, neutral, night */--mermaid-font-family: "trebuchet ms", verdana, arial, sans-serif;--mermaid-sequence-numbers: off; /* or "on", see https://mermaid-js.github.io/mermaid/#/sequenceDiagram?id&#61;sequencenumbers*/--mermaid-flowchart-curve: linear /* or "basis", see https://github.com/typora/typora-issues/issues/1632*/;--mermaid--gantt-left-padding: 75; /* see https://github.com/typora/typora-issues/issues/1665*/
}

Please note that if you export document with other themes than currently used one, some mermaid options will not be applied to exported HTML / PDF / Image. For example, if you currently use them Github, but while export to PDF, you set theme YYY for PDF export, and YYY.css defines --mermaid-sequence-numbers: on, then the --mermaid-sequence-numbers: on would not be applied to exported PDF.


Mermaid Theme

Added --mermaid-theme css variable to quickly define a mermaid theme that fits your theme, the value can be base, default, dark, forest, neutral, night (the one used in night theme), for example:


CSSMermaid Demo
:root {--mermaid-theme:dark;}Screen Shot 2020-12-05 at 17.08.46
:root {--mermaid-theme:forest;}Screen Shot 2020-12-05 at 17.09.42
:root {--mermaid-theme:neutral;}[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lRpjC6ej-1623159244998)(https://support.typora.io/media/new-97/Screen%20Shot%202020-12-05%20at%2017.10.11.png)]

Auto Numbering

Add --mermaid-sequence-numbers: on; in Custom CSS will enable auto numbering for sequence in mermaid:


–mermaid-sequence-numbers:off–mermaid-sequence-numbers:on
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZIeMbAGO-1623159245002)(https://support.typora.io/media/new-10/Screen%20Shot%202021-04-05%20at%2023.08.37.png)]Screen Shot 2021-04-05 at 23.20.31

Flowchart Curve

Add --mermaid-flowchart-curve: basis to get other type of curves.


–mermaid-flowchart-curve: linear;–mermaid-flowchart-curve: basis–mermaid-flowchart-curve: natural;–mermaid-flowchart-curve: step;
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DgDQ9VCY-1623159245008)(https://support.typora.io/media/new-10/Screen%20Shot%202021-04-05%20at%2023.25.41.png)]Screen Shot 2021-04-05 at 23.30.11[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6DePn3VE-1623159245013)(https://support.typora.io/media/new-10/Screen%20Shot%202021-04-05%20at%2023.28.06.png)][外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-eaG5lrK4-1623159245016)(https://support.typora.io/media/new-10/Screen%20Shot%202021-04-05%20at%2023.28.52.png)]

Gantt Padding


–mermaid–gantt-left-padding:75–mermaid–gantt-left-padding:200
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xpuZ5K2t-1623159245018)(https://support.typora.io/media/new-10/Screen%20Shot%202021-04-05%20at%2023.33.31.png)]Screen Shot 2021-04-05 at 23.33.00

hosted on Github.



推荐阅读
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 基于layUI的图片上传前预览功能的2种实现方式
    本文介绍了基于layUI的图片上传前预览功能的两种实现方式:一种是使用blob+FileReader,另一种是使用layUI自带的参数。通过选择文件后点击文件名,在页面中间弹窗内预览图片。其中,layUI自带的参数实现了图片预览功能。该功能依赖于layUI的上传模块,并使用了blob和FileReader来读取本地文件并获取图像的base64编码。点击文件名时会执行See()函数。摘要长度为169字。 ... [详细]
  • 生成对抗式网络GAN及其衍生CGAN、DCGAN、WGAN、LSGAN、BEGAN介绍
    一、GAN原理介绍学习GAN的第一篇论文当然由是IanGoodfellow于2014年发表的GenerativeAdversarialNetworks(论文下载链接arxiv:[h ... [详细]
  • 猜字母游戏
    猜字母游戏猜字母游戏——设计数据结构猜字母游戏——设计程序结构猜字母游戏——实现字母生成方法猜字母游戏——实现字母检测方法猜字母游戏——实现主方法1猜字母游戏——设计数据结构1.1 ... [详细]
  • 简单了解markdown语法
    Markdown语法标题三个“#”表示三级标题四个“#”表示四级标题字体粗体左右加俩“*”斜体左右加一’‘*“粗斜体左右加三个”*“表示删掉用俩波浪线引用加空格分割线图片![ ... [详细]
  • 用户登录 ... [详细]
  • ubuntu软件商店加载不出来_这款年度最爱的效率软件,其实我不太舍得分享出来...
    文章来源:工具狂人今天的这篇文章,想给大家介绍一个我近半年来一直在用的软件——滴答清单,相信不少朋友可能也用过或听过这个软件。滴答清单&# ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • Nginx使用(server参数配置)
    本文介绍了Nginx的使用,重点讲解了server参数配置,包括端口号、主机名、根目录等内容。同时,还介绍了Nginx的反向代理功能。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • 本文介绍了一些好用的搜索引擎的替代品,包括网盘搜索工具、百度网盘搜索引擎等。同时还介绍了一些笑话大全、GIF笑话图片、动态图等资源的搜索引擎。此外,还推荐了一些迅雷快传搜索和360云盘资源搜索的网盘搜索引擎。 ... [详细]
  • HTML学习02 图像标签的使用和属性
    本文介绍了HTML中图像标签的使用和属性,包括定义图像、定义图像地图、使用源属性和替换文本属性。同时提供了相关实例和注意事项,帮助读者更好地理解和应用图像标签。 ... [详细]
  • MarkDown编辑器Zettlr for mac
    Zettlrmac版是一款功能强大的MarkDown编辑器,ZettlrZettlr具有简洁简洁的设计,在无干扰的模式下使您可以专注于实际书写ÿ ... [详细]
  • 【卡夫卡的岛上书店】:一个利用 vuepress 的主题 vuepressthemereco 以及 vuepressthemevdoing 搭建自己的静态博客
    说明主题是用了vuepress-theme-reco1.6.1以及vuepress-theme-vdoing1.7.2,自己在此基础上进行了两款主题的融合ÿ ... [详细]
author-avatar
r_elease靜
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有