mermaid - マークダウンと同様の方法でテキストからフローチャートやシーケンス図などの図を生成する

(Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown)

Created at: 2014-11-02 07:52:32
Language: JavaScript
License: MIT

人魚

マークダウンのようなテキストからダイアグラムを生成します。

ライブエディター!

📖 ドキュメンテーション |🚀 はじめに |🌐 ティッカー |🙌 参加しませんか

简体中文



特定非営利活動法人 ビルド CI ステータス npm 縮小された gzip 圧縮されたバンドル サイズ カバレッジステータス CDN ステータス NPMダウンロード 私たちのスラックに参加してください! ツイッターフォロー

🏆 マーメイドは、「テクノロジーの最もエキサイティングな使用」のカテゴリーでJSオープンソースアワード(2019)にノミネートされ、受賞しました!!!

関係者全員のおかげで、プルリクエストをコミットする人々、質問に答える人々!🙏

マーメイド.jsを、実際の例、作成者からのヒントとコツで深く探索してください...マーメイドに関する最初の公式本は購入可能です。試してみて下さい!

に関しては

Mermaidは、JavaScriptベースの作図およびチャート作成ツールであり、Markdownに触発されたテキスト定義とレンダラーを使用して複雑な図を作成および変更します。Mermaidの主な目的は、ドキュメントが開発に追いつくのを助けることです。

ドックロットは、マーメイドが解決するのに役立つキャッチ22です。

ダイアグラム作成とドキュメント作成は、開発者の貴重な時間を要し、すぐに時代遅れになります。 しかし、図やドキュメントがないと、生産性が損なわれ、組織の学習が損なわれます。
Mermaidは、ユーザーが簡単に変更可能な図を作成できるようにすることで、この問題に対処します。また、本番スクリプト(およびその他のコード)の一部にすることもできます。

マーメイドを使用すると、プログラマーでなくても、マーメイドライブエディターを使用して詳細な図を簡単に作成できます。
チュートリアルにはビデオチュートリアルがあります。 お気に入りのアプリケーションでマーメイドを使用し、マーメイドの統合と使用法のリストを確認してください。

また、GitHub内でMermaidを使用するだけでなく、他の多くのお気に入りのアプリケーションを使用することもできます—Mermaidの統合と使用法のリストを確認してください。

マーメイドとそのより基本的な使用法のより詳細な紹介については、初心者向けガイド使用法チュートリアルを参照してください。

リリースプロセスでは、アプリケーションツールを使用した視覚的な回帰テストに大きく依存しています。Applitoolsは、使いやすく、テストと統合しやすい優れたサービスです。

以下は、マーメイドを使用して作成できる図、チャート、グラフの例です。ここをクリックして、テキスト構文にジャンプします。

フローチャート [ドキュメント - ライブエディタ]]

flowchart LR

A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
flowchart LR

A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]

シーケンス図 [ドキュメント - ライブエディタ]

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!

ガントチャート [ドキュメント - ライブエディタ]

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

クラス図 [ドキュメント - ライブ エディター]

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()
}
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()
}

状態図 [ドキュメント - ライブ エディター]]

stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]

円グラフ [ドキュメント - ライブ エディター]

pie
"Dogs" : 386
"Cats" : 85.9
"Rats" : 15
pie
"Dogs" : 386
"Cats" : 85.9
"Rats" : 15

Gitグラフ[実験的-ライブエディター]

ユーザージャーニー図 [ドキュメント - ライブ エディター]]

  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

C4ダイアグラム[ドキュメント]]

C4Context
title System Context diagram for Internet Banking System

Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
Person(customerB, "Banking Customer B")
Person_Ext(customerC, "Banking Customer C")
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")

Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")

Enterprise_Boundary(b1, "BankBoundary") {

  SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")

  System_Boundary(b2, "BankBoundary2") {
    System(SystemA, "Banking System A")
    System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
  }

  System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
  SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")

  Boundary(b3, "BankBoundary3", "boundary") {
    SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
    SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
  }
}

BiRel(customerA, SystemAA, "Uses")
BiRel(SystemAA, SystemE, "Uses")
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
Rel(SystemC, customerA, "Sends e-mails to")
C4Context
title System Context diagram for Internet Banking System

Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
Person(customerB, "Banking Customer B")
Person_Ext(customerC, "Banking Customer C")
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")

Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")

Enterprise_Boundary(b1, "BankBoundary") {

  SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")

  System_Boundary(b2, "BankBoundary2") {
    System(SystemA, "Banking System A")
    System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
  }

  System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
  SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")

  Boundary(b3, "BankBoundary3", "boundary") {
    SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
    SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
  }
}

BiRel(customerA, SystemAA, "Uses")
BiRel(SystemAA, SystemE, "Uses")
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
Rel(SystemC, customerA, "Sends e-mails to")

解放

そうする許可を持っている人のために:

のバージョン番号を更新します。

package.json

npm publish

上記のコマンドは、フォルダーにファイルを生成し、npmjs.org に公開します。

dist

関連プロジェクト

貢献良い創刊号 貢献 コミット

マーメイドは成長しているコミュニティであり、常に新しい貢献者を受け入れています。手伝うにはさまざまな方法があり、私たちは常に追加の手を探しています!どこから手伝いを始めればよいか知りたい場合は、この問題を見てください。

寄付方法に関する詳細情報は、寄付ガイドに記載されています

セキュリティと安全な図

パブリック サイトの場合、インターネット上のユーザーからテキストを取得し、そのコンテンツを後の段階でブラウザーに保存してブラウザーに保存するのは不安定な場合があります。その理由は、ユーザーコンテンツには、データが表示されたときに実行される悪意のあるスクリプトが埋め込まれている可能性があるためです。マーメイドにとって、これはリスクであり、特にマーメイドダイアグラムにはhtmlで使用される多くの文字が含まれているため、ダイアグラムも破損するため、標準の衛生状態が使用できなくなります。私たちはまだ着信コードをサニタイズし、プロセスを改良し続ける努力をしていますが、抜け穴がないことを保証することは困難です。

外部ユーザーがいるサイトのセキュリティレベルとして、コード内のJavaScriptが実行されないようにサンドボックス化されたiframeでダイアグラムがレンダリングされる新しいセキュリティレベルを導入できることを嬉しく思います。これは、セキュリティを向上させるための大きな前進です。

残念ながら、ケーキを食べると同時に食べることはできませんが、この場合、インタラクティブな機能の一部が悪意のあるコードとともにブロックされることを意味します。

脆弱性の報告

脆弱性を報告するには、問題の説明、問題を作成するために実行した手順、影響を受けるバージョン、および既知の問題がある場合は軽減策を電子メールで security@mermaid.live してください。

鑑賞

クヌート・スヴェイドクヴィストからの簡単なメモ:

グラフィカルレイアウトと描画ライブラリを提供してくれたd3およびdagre-d3プロジェクトに感謝します!

シーケンス図の文法の使用のためのjs-sequence-diagramプロジェクトにも感謝します。ガントレンダリングのインスピレーションと出発点を提供してくれたジェシカピーターに感謝します。

2017年<>月からコラボレーターを務めているタイラー・ロングに感謝します。

プロジェクトをここまで導いてくれた貢献者の増え続けるリストに感謝します!


マーメイドは、文書化を容易にするためにKnut Sveidqvistによって作成されました。