コンテンツにスキップ
Kong Logo | Kong Docs Logo
  • ドキュメント
    • API仕様を確認する
      View all API Specs すべてのAPI仕様を表示 View all API Specs arrow image
    • ドキュメンテーション
      API Specs
      Kong Gateway
      軽量、高速、柔軟なクラウドネイティブAPIゲートウェイ
      Kong Konnect
      SaaSのエンドツーエンド接続のための単一プラットフォーム
      Kong AI Gateway
      GenAI インフラストラクチャ向けマルチ LLM AI Gateway
      Kong Mesh
      Kuma と Envoy をベースにしたエンタープライズサービスメッシュ
      decK
      Kongの構成を宣言型で管理する上で役立ちます
      Kong Ingress Controller
      Kubernetesクラスタ内で動作し、Kongをプロキシトラフィックに設定する
      Kong Gateway Operator
      YAMLマニフェストを使用してKubernetes上のKongデプロイメントを管理する
      Insomnia
      コラボレーティブAPI開発プラットフォーム
  • Plugin Hub
    • Plugin Hubを探索する
      View all plugins すべてのプラグインを表示 View all plugins arrow image
    • 機能性 すべて表示 View all arrow image
      すべてのプラグインを表示
      AI's icon
      AI
      マルチ LLM AI Gatewayプラグインを使用してAIトラフィックを管理、保護、制御する
      認証's icon
      認証
      認証レイヤーでサービスを保護する
      セキュリティ's icon
      セキュリティ
      追加のセキュリティレイヤーでサービスを保護する
      トラフィック制御's icon
      トラフィック制御
      インバウンドおよびアウトバウンドAPIトラフィックの管理、スロットル、制限
      サーバーレス's icon
      サーバーレス
      他のプラグインと組み合わせてサーバーレス関数を呼び出します
      分析と監視's icon
      分析と監視
      APIとマイクロサービストラフィックを視覚化、検査、監視
      変革's icon
      変革
      Kongでリクエストとレスポンスをその場で変換
      ログ記録's icon
      ログ記録
      インフラストラクチャに最適なトランスポートを使用して、リクエストと応答データをログに記録します
  • サポート
  • コミュニティ
  • Kongアカデミー
デモを見る 無料トライアルを開始
貢献ガイドライン
  • Home icon
  • Style guide and contribution guidelines
  • Diagrams in the docs
report-issue問題を報告する
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Kong AI Gateway
  • Plugin Hub
  • decK
  • Kong Ingress Controller
  • Kong Gateway Operator
  • Insomnia
  • Kuma

  • ドキュメント投稿ガイドライン
  • Contribution guidelines
  • Style guidelines
    • Style guide
    • Word choice and naming
    • Notes and other notices
    • Diagrams
    • Documenting user interfaces
    • Contribution templates
    • Plugin documentation
      • Documenting Kong-owned plugins
      • Documenting partner plugins
  • Markdown rules and formatting
    • Markdown rules
    • Reusable content
    • Variables
    • Single-sourced versions
    • Single-sourced plugins
    • Conditional rendering
  • Community
    • Welcome to the Kong Docs community
    • Community expectations
    • Hackathons
enterprise-switcher-icon 次に切り替える: OSS
On this pageOn this page
  • Add a diagram to the docs
  • Styling
  • Export a Mermaid diagram from the docs

このページは、まだ日本語ではご利用いただけません。翻訳中です。

Diagrams in the docs

The Kong Docs include built-in support for mermaid.js. This tool lets you build diagrams directly in Markdown without needing any extra diagram software.

We recommend using Mermaid’s online editor to write your diagrams and see the output side-by-side. When you’re happy with it, copy the code and paste it directly into a docs markdown file.

Tip: If you want to see what the diagram will look like in the docs, use this sample chart with styling config instead, and switch the Theme in the top menu to light mode.

The most commonly used diagram types in the Kong docs are the flowchart and the sequence diagram. You can cover most use cases with these two types. Follow mermaid.js’s docs to learn about node and link styles for each diagram.

If you run into node or link positioning issues in flowcharts, try to rearrange the elements in the chart, link them in different ways, or change the direction of the chart. You can also use subgraphs to help with positioning.

Add a diagram to the docs

To add a diagram to a doc, declare it with the {% mermaid %} and {% endmermaid %} tags.

Here’s an example of a flowchart with links to the final decisions:

{% mermaid %}
flowchart TD
    %% this section defines the node and their labels
    A{Deployment type?}
    B(Traditional mode)
    C(Hybrid mode)
    D(DB-less mode)
    E(Konnect DP)
    F{Enough hardware to 
    run another cluster?}
    G(Upgrade CP first)
    H(Upgrade DP second)
    I([Dual-cluster upgrade])
    J([In-place upgrade])
    K([Rolling upgrade])

    %% this section defines all the connections between nodes
    A --> B
    A --> C
    A --> D
    A --> E
    B ---> F
    C --> G & H
    D ----> K
    E ----> K
    G --> F
    F ---Yes--->I
    F ---No--->J
    H ---> K

    %% this section defines node interactions
    click K "/gateway/latest/upgrade/rolling-upgrade/"
    click I "/gateway/latest/upgrade/dual-cluster/"
    click J "/gateway/latest/upgrade/in-place/"
{% endmermaid %}

The code above creates the following diagram:

Styling

All diagrams built with mermaid.js have built-in styling. If you need to adjust styling, you can set styles in the diagram definition with the style tag for nodes, or the linkStyle tag for lines.

Tip: Since links (aka lines or connectors) don’t have names/IDs like nodes do, you have to style links by numbering them. It can be difficult to tell what order the links are in, and which connector the style will apply to. Mermaid’s online editor lets you test this out in real time, so you can quickly figure out the numbers.

To avoid having to reshuffle anything or re-figure out the numbers, apply link styling after you have added all the nodes and links to your diagram.

Here are some basic style tags to know:

  • fill: The background color of an element
  • stroke: The line color of an element. For a node, this refers to a border color; for a link, this refers to its line color.
  • stroke-dasharray: Turns the border of a node into a dashed line.

    Note that you don’t need to do this for links, as you can specify a dotted link by using -.-> instead of -->.

Here’s some examples of these styles in use:

style API stroke:none
# Removes the border from the API node

style DBX stroke-dasharray:3
# Turns the border of the DBX node into a dashed line

style Admin fill:none,stroke:none,color:#d44324
# Removes the fill and border of the admin node and changes the text colour to the hex code above

linkStyle 4,7 stroke:#d44324,color:#d44324
# Changes the line and text color of the 4th and 7th connectors in the diagram

linkStyle 3,6,9 stroke:#b6d7a8
# Changes the line color of the 3rd, 6th, and 9th connectors in the diagram

These styles are all used to create the following diagram:

Diagram
Source code of diagram
 
flowchart TD
    DBX[(Current
    database)]
    DBY[(New 
    database)]
    CPX(Current 
    Kong Gateway X)
    Admin(No admin 
    write operations)
    Admin2(No admin 
    write operations)
    CPY(New 
    Kong Gateway Y)
    LB(Load balancer)
    API(API requests)

    API --> LB & LB & LB & LB
    Admin2 -."X".- CPX
    LB -.90%.-> CPX
    LB --10%--> CPY
    Admin -."X".- CPY
    CPX -.-> DBX
    CPY --pg_restore--> DBY

    style API stroke:none
    style DBX stroke-dasharray:3
    style CPX stroke-dasharray:3
    style Admin fill:none,stroke:none,color:#d44324
    style Admin2 fill:none,stroke:none,color:#d44324
    linkStyle 4,7 stroke:#d44324,color:#d44324
    linkStyle 3,6,9 stroke:#b6d7a8
  
{% mermaid %}
flowchart TD
    DBX[(Current
    database)]
    DBY[(New 
    database)]
    CPX(Current 
    {{site.base_gateway}} X)
    Admin(No admin 
    write operations)
    Admin2(No admin 
    write operations)
    CPY(New 
    {{site.base_gateway}} Y)
    LB(Load balancer)
    API(API requests)

    API --> LB & LB & LB & LB
    Admin2 -."X".- CPX
    LB -.90%.-> CPX
    LB --10%--> CPY
    Admin -."X".- CPY
    CPX -.-> DBX
    CPY --pg_restore--> DBY

    style API stroke:none
    style DBX stroke-dasharray:3
    style CPX stroke-dasharray:3
    style Admin fill:none,stroke:none,color:#d44324
    style Admin2 fill:none,stroke:none,color:#d44324
    linkStyle 4,7 stroke:#d44324,color:#d44324
    linkStyle 3,6,9 stroke:#b6d7a8
{% endmermaid %}

Export a Mermaid diagram from the docs

You can export a Mermaid diagram from the Kong docs using the Mermaid live editor. This method will only work with diagrams that don’t contain icons or images.

  1. Copy the Mermaid diagram from the Kong doc file. You can find the doc source file by clicking Edit this page at the top right corner of the doc.
  2. Paste the Mermaid diagram into the Mermaid live editor.
  3. If the diagram contains images, remove all <img> tags.
  4. Replace any Liquid variables (for example, {{site.base_gateway}}) with their output. Liquid variables won’t render correctly in the Mermaid live editor.
  5. Click Actions on the bottom left corner and select the file type you want to export the diagram to.
Thank you for your feedback.
Was this page useful?
情報が多すぎる場合 close cta icon
Kong Konnectを使用すると、より多くの機能とより少ないインフラストラクチャを実現できます。月額1Mリクエストが無料。
無料でお試しください
  • Kong
    APIの世界を動かす

    APIマネジメント、サービスメッシュ、イングレスコントローラーの統合プラットフォームにより、開発者の生産性、セキュリティ、パフォーマンスを大幅に向上します。

    • 製品
      • Kong Konnect
      • Kong Gateway Enterprise
      • Kong Gateway
      • Kong Mesh
      • Kong Ingress Controller
      • Kong Insomnia
      • 製品アップデート
      • 始める
    • ドキュメンテーション
      • Kong Konnectドキュメント
      • Kong Gatewayドキュメント
      • Kong Meshドキュメント
      • Kong Insomniaドキュメント
      • Kong Konnect Plugin Hub
    • オープンソース
      • Kong Gateway
      • Kuma
      • Insomnia
      • Kongコミュニティ
    • 会社概要
      • Kongについて
      • お客様
      • キャリア
      • プレス
      • イベント
      • お問い合わせ
  • 利用規約• プライバシー• 信頼とコンプライアンス
© Kong Inc. 2025