Return to site

Typora Diagrams

broken image


Many of the same advanced markdown features are in Typora, meaning that you can type up nicely-formatted notes without ever having to shift your hand to your mouse. Even so, if you want to get a little bit fancy, Typora supports tables, diagrams, mathematical formats, footnotes, code fences, and task lists. Typora Pricing: Free app: Yes, during. Lee, In response to 'our internal feature request list', I offer the following user story. As a professional software developer, I would like more transparency into the GitHub feature request process, and the opportunity to contribute open source soultions to address such feature requests.

  1. Typora Mermaid
  2. Markdown Sequence Diagram
Diagrams

With the recent adoption of Infrastructure as Code we aim to eliminate theimpudent mismatch of documentation (eg. how is it supposed to look like) and howit actually set up by driving all changes from a textual representation.

Typora Mermaid

While JSON, YAML and HCL does a good job of representing out intent to acomputer it is not easily consumable for humans - unless you live and breath forthese types of configuration languages 🧙‍♂️

A diagram does a much better job of conveying information and relationships tous mortal humans but they struggle to keep up with the never ending changes asthey are often hand drawn and a snapshot somewhere in time. Who knows where themaster file for that one Visio diagram is, right?!

  • . an asterisk starts an unordered list. and this is another item in the list + or you can also use the + character - or the - character To start an ordered list, write this: 1. This starts a list.with. numbers + this will show as number '2'. this will show as number '3.'
  • Basicarrows tohead yields rightarrow yields leftarrow yields leftrightarrow yields Rightarrow yields Leftarrow yields Leftrightarrow yields Arrowsfrombar mapsto yields mapsto yields mapsfrom yields Mapsto yields Mapsfrom yields 3. Arrowswithhook hook yields hook' yields hookrightarrow yields.

What if we could generate our diagrams in the same way as we generate ourinfrastructure?

This post aims to give an overview of the current state of diagram tools thatsupport some kind of Diagram as Code functionality. Lets dig in! 😄

Overview

Super image resizer v3 1 1. Bellow is a table over the most popular tools with support for Diagram as Code.We have included some popular proprietary tools in the list but will leave it asan exercise to the reader to explore those as this post will focus on those thatare free and open source.

ToolDiagram LanguageLicenseLocalOnline
GraphvizDOTEclipse Public License 1.0
PlantUMLTextGPL-3.0
MermaidTextMIT License
DitaaASCIILGPL-3.0
WSDText
code2flowText
StructurizrJava, .NET

Graphviz (Live Demo)

Rock solid, and bindings for just about every language!

Graphviz is an open source graph visualization software written in C. It hasseveral main layout programs. It also has web and interactive graphicalinterfaces, and auxiliary tools, libraries, and a rich set of language bindings.The main project itself is not investing in graphical user interface editors,but leaving that up to the community to incorporate Graphviz. This results inGraphviz often being perceived as a little more low-level compared with theothers.

The Graphviz layout programs take descriptions of graphs in a simple textlanguage named DOT, and make diagrams in useful formats, such as images and SVGfor web pages; PDF or Postscript for inclusion in other documents; or display in an interactive graph browser.

Graphviz has many useful features for concrete diagrams, such as options forcolors, fonts, tabular node layouts, line styles, hyperlinks, and custom shapes.

In practice, graphs are usually generated from an external data sources, butthey can also be created and edited manually, either as raw text files or withina graphical editor. (Graphviz was not intended to be a Visio replacement, so itis probably frustrating to try to use it that way.)

Example diagram

PlantUML (Live Demo)

PlantUML is, imho, the most efficient and maintainable way to produce UMLdiagram.

PlantUML is another trued and true tool used written in Java to draw primarilyUML diagrams, using a simple and human readable text description. Be careful,because it does not prevent you from drawing inconsistent diagrams (such ashaving two classes inheriting from each other, for example). So it's more adrawing tool than a modeling tool.

PlantUML has its own simple, but powerful, domain specific language (DSL) thatallows for a lot of different types of UML diagrams:

  • Sequence diagrams
  • Usecase diagrams
  • Class diagrams
  • Activity diagrams
  • Component diagrams
  • State diagrams
  • Object diagrams
  • Deployment diagrams
  • Timing diagrams

Also, it supports some non-UML diagrams which are pretty cool, for example theWireframe diagrams for UI design. Fun fact some of the diagrams in PlantUML isactually powered by Graphviz.

PlantUML is also supported in GitLabmarkdownand there is an integration for VSCode,Atom,MediaWiki, GoogleDocsas well as Microsoft Word to mention a few and thisgreatly expends its usefulness!

PlantUML is primarily an UML drawing tool, and maybe the best there is. However,it is starting to show it's age along with the JVM, it's lack of modern diagramstyling and web integrations.

Example Diagram

Mermaid (Live Editor)

Mermaid lets you easily do is generate sequence diagrams from code such astest-cases, because the format is so simple and line-driven ✨

Mermaid is a diagram tool built for the web-era with native JavaScript supportjust include the js file and start rendering diagrams real time. It does notsupport as many diagrams as it's competitors (yet) but it is completelythemeable and has a rich and powerful syntax.

Mermaid is not a particular UML tool but rather a more general purpose diagramtool and supports the following diagrams:

Comparing with Visio and similar applications, mermaid is a really fast way tocreate good visualizations. This is especially apparent when editing a complexvisualization, this could take hours in traditional tool but takes minutes (oreven less if generation has been scripted) with mermaid.

Mermaid also has support for Graphviz's dot graph notation which makes it supereasy to reusing existing diagrams and it is fully integrated withhttps://docs.gitlab.com/ee/user/markdown.html! It has a VSCode,Atom, GoogleChrome,Confluenceextensions and the typora.io markdown editor comes withfull Mermaid diagram support out of the box.

Memaid's strongest suite is it's simplicity and modern look and feel. Forfrontend developers this would be like any other JavaScript library. It'sstrongest suite is also it's disadvantage requiringPhantomJS (and thus 500 MB of compiled Chromium) inorder to render diagrams from the command line.

Example Diagram

Mermaid syntax guide.

graph TDA[Christmas] -->|Get money| B(Go shopping)B --> C{Let me think}C -->|One| D[Laptop]C -->|Two| E[iPhone]C -->|Three| F[fa:fa-car Car]

NB! The above diagram is rendered live using the latest version of Mermaidinkluded in this blogpost - just take a look at the source code.

Markdown Sequence Diagram

Closing Remarks

While some of these tools mentioned in this post is quit mature at this point weare not happy with the current state of integrating them with other tools in theIaC ecosystem. Our wish for 2020 is that some of these integrations will happen!

Happy diagramming! 😄

Discuss on Hacker News

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.

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

For more details, please see this syntax explanation.

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

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.

Flowcharts

For more details see these instructions.

Gantt Charts

For more details see these instructions.

Class Diagrams

For more details see these instructions.

State Diagrams

For more details see these instructions.

Pie Charts





broken image