kroki合集

image-20220715114804075

kroki两种用法

kroki-<target_format>

引入用法


\!\[title\]\(kroki-<target_format>\:file_relativepath)

使用注意

样式冲突

kroki-svgbob会引入text样式,font-size固定为14px。
就导致其他格式渲染图像出现文字重叠问题

参考资源

Kroki!

Kroki! Examples

IntelliPikchr: IDEA内置插件

Split editor with preview pane for .pikchr files, using kroki.io or self-hosted server for rendering

mdbook-kroki-preprocessor: 支持kroki渲染

kroki可以看作多种图表语言的统一接口

md语法

The code block’s language has to be kroki-.

  • kroki-mermaid
  • kroki-plantuml
cargo install mdbook-kroki-preprocessor

kori支持范围

编码类

Block Diagram

blockdiag

kroki-blockdiag


  
    
      
    
  
  blockdiag
  blockdiag {
  blockdiag -> generates -> "block-diagrams";
  blockdiag -> is -> "very easy!";

  blockdiag [color = "greenyellow"];
  "block-diagrams" [color = "pink"];
  "very easy!" [color = "orange"];
}
  
  
  
  
  
  
  blockdiag
  
  generates
  
  is
  
  block-diagrams
  
  very easy!
  
  
  
  
  
  
  
  
  
  

Sequence diagram

kroki-seqdiag


  
    
      
    
  
  blockdiag
  seqdiag {
  browser  -> webserver [label = "GET /index.html"];
  browser <-- webserver;
  browser  -> webserver [label = "POST /blog/comment"];
  webserver  -> database [label = "INSERT comment"];
  webserver <-- database;
  browser <-- webserver;
}
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  browser
  
  webserver
  
  database
  
  
  
  
  
  
  
  
  
  
  
  
  GET /index.html
  POST /blog/comment
  INSERT comment

Activity diagram

kroki-actdiag


  
    
      
    
  
  blockdiag
  actdiag {
  write -> convert -> image

  lane user {
    label = "User"
    write [label = "Writing reST"];
    image [label = "Get diagram IMAGE"];
  }
  lane actdiag {
    convert [label = "Convert reST to Image"];
  }
}
  
  
  
  
  User
  
  actdiag
  
  
  
  
  Writing reST
  
  Convert reST to Imag
  e
  
  Get diagram IMAGE
  
  
  
  
  
  
  
  

Network diagram

kroki-nwdiag


  
    
      
    
  
  blockdiag
  nwdiag {
  network dmz {
    address = "210.x.x.x/24"

    web01 [address = "210.x.x.1"];
    web02 [address = "210.x.x.2"];
  }
  network internal {
    address = "172.x.x.x/24";

    web01 [address = "172.x.x.1"];
    web02 [address = "172.x.x.2"];
    db01;
    db02;
  }
}
  
  
  
  
  
  
  
  
  
  
  
  
  
  dmz
  210.x.x.x/24
  internal
  172.x.x.x/24
  
  210.x.x.1
  
  172.x.x.1
  
  web01
  
  210.x.x.2
  
  172.x.x.2
  
  web02
  
  
  db01
  
  
  db02

pikchr:

kroki-pikchr

Commit Graph







C0



C1



C2



C4



C6

C3



C5



C3'



C5'


trunk
feature branch

C0



C1



C2



C4



C6

C3



C5



C7




trunk
feature branch


Syntax diagram



element








object-definition







 LABEL 



":"



position









 VARIABLE 



assignment-operator



expr




"print"



print-args



Impossible trident














Structurizr

what is

Diagrams as code 2.0

Structurizr builds upon “diagrams as code”, allowing you to create multiple diagrams from a single model, using a number of tools and programming languages.

This Structurizr DSL example creates two diagrams, based upon a single set of elements and relationships.

kroki-structurizr

Contaner diagram

Internet Banking System - ContainersInternet Banking System[Software System]Web Application[Container: Java and Spring MVC] Delivers the static contentand the Internet bankingsingle page application.API Application[Container: Java and Spring MVC] Provides Internet bankingfunctionality via aJSON/HTTPS API.Database[Container: Oracle Database Schema] Stores user registrationinformation, hashedauthentication credentials,access logs, etc.Single-PageApplication[Container: JavaScript and Angular] Provides all of the Internetbanking functionality tocustomers via their webbrowser.Mobile App[Container: Xamarin] Provides a limited subset ofthe Internet bankingfunctionality to customers viatheir mobile device.Personal BankingCustomer[Person] A customer of the bank, withpersonal bank accounts.Mainframe BankingSystem[Software System] Stores all of the corebanking information aboutcustomers, accounts,transactions, etc.E-mail System[Software System] The internal MicrosoftExchange e-mail system.Sends e-mails toVisits bigbank.com/ibusing[HTTPS]Views accountbalances, andmakes paymentsusingViews accountbalances, andmakes paymentsusingDelivers to thecustomer's webbrowserMakes API calls to[JSON/HTTPS]Makes API calls to[JSON/HTTPS]Reads from andwrites to[JDBC]Makes API calls to[XML/HTTPS]Sends e-mail using

Plantuml

kroki-plantuml

use case diagram

checkoutpaymenthelpcustomerclerkincludeextends

work breakdown structure

Launch the projectComplete Stakeholder ResearchInitial Implementation PlanDesign phaseModel of AsIs Processes CompletedModel of AsIs Processes Completed1Model of AsIs Processes Completed2Measure AsIs performance metricsIdentify Quick WinsComplete innovate phaseBusiness Process Modelling WBS

Mind Map

OSUbuntuLinux MintKubuntuLubuntuKDE NeonLMDESolydXKSteamOSRaspbianWindows 95Windows 98Windows NTWindows 8Windows 10

引入文件不支持!include

可以直接在markdown里面引入

Component diagram
Context diagram
Container diagram

绘制类

Packet diagram: 可被plantuml替代

Package diagram, a kind of structural diagram, shows the arrangement and organization of model elements in middle to large scale project. Package diagram can show both structure and dependencies between sub-systems or modules, showing different views of a system, for example, as multi-layered (aka multi-tiered) application - multi-layered application model.

kroki-packetdiag


  
    
      
    
  
  blockdiag
  packetdiag {
  colwidth = 32;
  node_height = 72;

  0-15: Source Port;
  16-31: Destination Port;
  32-63: Sequence Number;
  64-95: Acknowledgment Number;
  96-99: Data Offset;
  100-105: Reserved;
  106: URG [rotate = 270];
  107: ACK [rotate = 270];
  108: PSH [rotate = 270];
  109: RST [rotate = 270];
  110: SYN [rotate = 270];
  111: FIN [rotate = 270];
  112-127: Window;
  128-143: Checksum;
  144-159: Urgent Pointer;
  160-191: (Options and Padding);
  192-223: data [colheight = 3];
}
  
  0
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  16
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  32
  
  
  
  
  
  Source Port
  
  
  
  
  
  Destination Port
  
  
  
  
  
  Sequence Number
  
  
  
  
  
  Acknowledgment Number
  
  
  
  
  
  Data Offset
  
  
  
  
  
  Reserved
  
  
  
  
  
  
    URG
  
  
  
  
  
  
  
    ACK
  
  
  
  
  
  
  
    PSH
  
  
  
  
  
  
  
    RST
  
  
  
  
  
  
  
    SYN
  
  
  
  
  
  
  
    FIN
  
  
  
  
  
  
  Window
  
  
  
  
  
  Checksum
  
  
  
  
  
  Urgent Pointer
  
  
  
  
  
  (Options and Padding)
  
  
  
  
  
  data

Rack diagram

kroki-rackdiag


  
    
      
    
  
  blockdiag
  rackdiag {
  16U;
  1: UPS [2U];
  3: DB Server;
  4: Web Server;
  5: Web Server;
  6: Web Server;
  7: Load Balancer;
  8: L3 Switch;
}
  
  
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  15
  16
  
  UPS
  [2U]
  
  DB Server
  
  Web Server
  
  Web Server
  
  Web Server
  
  Load Balancer
  
  L3 Switch

Object Oriented Graph

kroki-graphviz



unix

Object Oriented Graphs
Stephen North, 3/19/93


5th Edition

5th Edition



6th Edition

6th Edition



5th Edition->6th Edition





PWB 1.0

PWB 1.0



5th Edition->PWB 1.0





LSX

LSX



6th Edition->LSX





1 BSD

1 BSD



6th Edition->1 BSD





Mini Unix

Mini Unix



6th Edition->Mini Unix





Wollongong

Wollongong



6th Edition->Wollongong





Interdata

Interdata



6th Edition->Interdata





PWB 1.2

PWB 1.2



PWB 1.0->PWB 1.2





USG 1.0

USG 1.0



PWB 1.0->USG 1.0





2 BSD

2 BSD



1 BSD->2 BSD





Unix/TS 3.0

Unix/TS 3.0



Interdata->Unix/TS 3.0





PWB 2.0

PWB 2.0



Interdata->PWB 2.0





7th Edition

7th Edition



Interdata->7th Edition





TS 4.0

TS 4.0



Unix/TS 3.0->TS 4.0





PWB 2.0->Unix/TS 3.0





8th Edition

8th Edition



7th Edition->8th Edition





32V

32V



7th Edition->32V





V7M

V7M



7th Edition->V7M





Ultrix-11

Ultrix-11



7th Edition->Ultrix-11





Xenix

Xenix



7th Edition->Xenix





UniPlus+

UniPlus+



7th Edition->UniPlus+





9th Edition

9th Edition



8th Edition->9th Edition





3 BSD

3 BSD



32V->3 BSD





V7M->Ultrix-11





2.8 BSD

2.8 BSD



2 BSD->2.8 BSD





2.8 BSD->Ultrix-11





2.9 BSD

2.9 BSD



2.8 BSD->2.9 BSD





4 BSD

4 BSD



3 BSD->4 BSD





4.1 BSD

4.1 BSD



4 BSD->4.1 BSD





4.1 BSD->8th Edition





4.1 BSD->2.8 BSD





4.2 BSD

4.2 BSD



4.1 BSD->4.2 BSD





4.3 BSD

4.3 BSD



4.2 BSD->4.3 BSD





Ultrix-32

Ultrix-32



4.2 BSD->Ultrix-32





PWB 1.2->PWB 2.0





CB Unix 1

CB Unix 1



USG 1.0->CB Unix 1





USG 2.0

USG 2.0



USG 1.0->USG 2.0





CB Unix 2

CB Unix 2



CB Unix 1->CB Unix 2





USG 3.0

USG 3.0



USG 2.0->USG 3.0





CB Unix 3

CB Unix 3



CB Unix 2->CB Unix 3





Unix/TS++

Unix/TS++



CB Unix 3->Unix/TS++





PDP-11 Sys V

PDP-11 Sys V



CB Unix 3->PDP-11 Sys V





CB Unix 3->TS 4.0





Unix/TS++->TS 4.0





USG 3.0->Unix/TS 3.0





Unix/TS 1.0

Unix/TS 1.0



Unix/TS 1.0->Unix/TS 3.0





System V.0

System V.0



TS 4.0->System V.0





System V.2

System V.2



System V.0->System V.2





System V.3

System V.3



System V.2->System V.3





Entity Relationship Diagram

kroki-erd






Person

Person

name

height

weight

birth_location_id



Location

Location

id

city

state

country



Person--Location

1
0..N



Diagramsnet/drawio

kroki-diagramsnet:../../../materials/diagramsnet.drawio 还处于实验性质,测试未成功

Excalidraw: hand-draw like diagrams

kroki-excalidraw


  
  
  
    
  
  JavaScriptFetchParseCompile and OptimizeRe-optimize and DeoptimizeExecuteGC

idea自带插件:

Excalidraw Integration - IntelliJ IDEs Plugin | Marketplace

更正:目前新版的Excalidraw Integration已经修复,修改后会直接更新源文件!

idea插件不适合kroki-excalidraw

  1. Excalidraw Integration只是一个画图工具:
  • 没有保存文件按钮,只能导出为图片
  • 哪怕打开画好的文件,也只能预览,修改之后不能保存更新源文件

那还不如用在线app

  1. 在线excalidraw的文件才是kroki-excalidraw可用的
  • 可以载入第三方组件库

在线绘制工具

excalidraw/excalidraw: Virtual whiteboard for sketching hand-drawn like diagrams

将绘制步骤动态化

dai-shi/excalidraw-animate: A tool to animate Excalidraw drawings

好用的库

excalidraw/excalidraw-libraries: Collection of publicly available libraries

创建幻灯片

dai-shi/excalidraw-claymate: A tool based on Excalidraw to create stop motion animations and slides.

vega

kroki-vega/vegalite

相关资源

Vega Examples

word cloud

DECLARATIVEVISUALIZATIONGRAMMARSACCELERATEDEVELOPMENTFACILITATERETARGETINGACROSSPLATFORMSALLOWLANGUAGELEVELOPTIMIZATIONSHOWEVEREXISTINGLANGUAGESPRIMARILYCONCERNEDVISUALENCODINGRELYIMPERATIVEEVENTHANDLERSINTERACTIVEBEHAVIORSRESPONSEINTRODUCEMODELINTERACTIONDESIGNDATAVISUALIZATIONSADOPTINGMETHODSREACTIVEPROGRAMMINGLOWEVENTSCOMPOSABLESTREAMSFORMHIGHERSEMANTICSIGNALSFEEDPREDICATESSCALEINVERSIONSGENERALIZESELECTIONSITEMGEOMETRYPIXELSQUERIESDOMAINPRODUCTIONRULESUSEMANIPULATEAPPEARANCEREUSESHARINGCONSTRUCTSENCAPSULATEDNAMEDINTERACTORSSTANDALONEPURELYSPECIFICATIONSTECHNIQUESASSESSFEASIBILITYEXPRESSIVITYINSTANTIATINGEXTENSIONSVEGAGRAMMARDIVERSERANGEEXAMPLESDEMONSTRATECOVERAGEESTABLISHEDTAXONOMYPRESENTSYSTEMARCHITECTUREPROVIDESFIRSTROBUSTCOMPREHENSIVETREATMENTSTARTINGSINGLESPECIFICATIONDATAFLOWGRAPHINPUTSCENEELEMENTSTREATEDCLASSSTREAMINGSOURCESSUPPORTEXPRESSIVEMAYINVOLVETIMEVARYINGSCALARRELATIONALHIERARCHICALDYNAMICALLYWRITERUNTIMEEXTENDINGPRUNINGBRANCHESDRIVENFASHIONDISCUSSCOMPILERUNAPPLIEDWITHINSHARERESULTSBENCHMARKSTUDIESINDICATESUPERIORPERFORMANCEORIGINALNONLITEHIGHENABLESRAPIDCOMBINESTRADITIONALGRAPHICSPROVIDINGCOMPOSITIONALGEBRALAYEREDMULTIVIEWDISPLAYSNOVELUSERSSPECIFYSEMANTICSCOMPOSINGSELECTIONABSTRACTIONDEFINESPROCESSINGPOINTSINTERESTPREDICATEFUNCTIONINCLUSIONTESTINGPARAMETERIZEENCODINGSSERVINGDEFININGEXTENTSDRIVINGCONDITIONALLOGICCOMPILERAUTOMATICALLYSYNTHESIZESREQUISITEFLOWHANDLINGOVERRIDECUSTOMIZATIONCONTRASTDECOMPOSECONCISEENUMERABLEUNITSEVALUATEDEMONSTRATINGSUCCINCTCUSTOMIZEDCOMMONPANNINGZOOMINGLINKED

Diverging Stacked Bar Chart

−40−20020406080100PercentageQuestion 1Question 2Question 3Question 4Question 5Question 6Question 7Question 8QuestionStrongly disagreeDisagreeNeither agree nor disagreeAgreeStrongly agreeResponse

Ditaa: Conjugate prior relationships

ditaa的含义

ditaa 是 DIagrams Through Ascii Art,作者是 Stathis Sideris。

支持ascii图像渲染 kroki-ditaa

ExponentiallambdataulambdaLognormalGammaPoissonbetatautauNormalmu

相关资源

Mermaid

kroki-mermaid

Sequence diagram

AliceBobJohnloop[Healthcheck]Rational thoughts prevail...Hello John, how are you?Fight against hypochondriaGreat!How about you?Jolly good!AliceBobJohn

Gantt

A Gantt Diagram2014-01-052014-01-122014-01-192014-01-262014-02-022014-02-092014-02-16A task           Task in sec      another task     Another task     SectionAnotherA Gantt Diagram

Nomnoml: UML diagram

kroki-nomnoml


	[Pirate|eyeCount: Int|raid();pillage()|
	  [beard]--[parrot]
	  [beard]-:>[foul mouth]
	]
	
	[<abstract>Marauder]<:--[Pirate]
	[Pirate]- 0..7[mischief]
	[jollyness]->[Pirate]
	[jollyness]->[rum]
	[jollyness]->[singing]
	[Pirate]-> *[rum|tastiness: Int|swig()]
	[Pirate]->[singing]
	[singing]<->[rum]
	
	[<start>st]->[<state>plunder]
	[plunder]->[<choice>more loot]
	[more loot]->[st]
	[more loot] no ->[<end>e]
	
	[<actor>Sailor] - [<usecase>shiver me;timbers]
	
		
			
				
			
			
				
					
						
					
					
					0..7
					
					
					
					
					
					
					
					*
					
					
					
					
					
					
					
					
					
					
					
					
					
					no
					
					
					
					
						
							
							
							
							
						
						
							
								Pirate
								
							
						
						
							
								eyeCount: Int
								
							
						
						
							
								raid()
								pillage()
								
							
						
						
							
								
									
										
									
									
									
									
										
											
										
										
											
												beard
												
											
										
									
									
										
											
										
										
											
												parrot
												
											
										
									
									
										
											
										
										
											
												foul mouth
												
											
										
									
								
							
						
					
					
						
							
							
							
						
						
							
								rum
								
							
						
						
							
								tastiness: Int
								
							
						
						
							
								swig()
								
							
						
					
					
						
							
						
						
							
								Marauder
								
							
						
					
					
						
							
						
						
							
								mischief
								
							
						
					
					
						
							
						
						
							
								jollyness
								
							
						
					
					
						
							
						
						
							
								singing
								
							
						
					
					
						
							
						
					
					
						
							
						
						
							
								plunder
								
							
						
					
					
						
							
						
						
							
								more loot
								
							
						
					
					
						
							
							
						
					
					
						
							
							
							
							
						
						
							
								Sailor
								
							
						
					
					
						
							
						
						
							
								shiver me
								timbers
								
							
						
					
				
			
		
	

相关资源

BPMN

bpmn-js

来历

  • 业务流程模型和标记法是一套图形化表示法,用于以业务流程模型详细说明各种业务流程。

  • 它最初由业务流程管理倡议组织开发,名称为“Business Process Modeling Notation“,

即“业务流程建模标记法”。

kroki-bpmn

Pizza CustomerHungry for pizzaSelect a pizzaOrder a pizzapizza received60 minutesAsk for the pizzaPay the pizzaEat the pizzaHunger satisfiedPizza vendordelivery boypizza chefclerkOrder received„where is my pizza?“Calm customerBake the pizzaDeliver the pizzaReceive paymentpizza orderreceiptmoneypizza

相关资源

Bytefield

kroki-bytefield, 不支持引入

WaveDrom: Digital Timing diagram

kroki-wavedrom

clkDataheadbodytaildataRequestAcknowledge

Svgbob

kroki-svgbob

connected Servers


  
  
    
      
    
    
      
    
    
      
    
    
      
    
    
      
    
  
  
  
  
  
  
  
  
  ,
  
  
  
  .
  
  
  ,
  )
  
  .
  
  '
  
  [
  ]
  ::
  
  
  
  [
  
  ...
  
  
  .
  
  '
  
  ::::
  
  O
  
  ]
  ]
  |
  |
  
  
  
    
    
    
    
  
  
    
    
    
    
    
    
    
  
  
    
    
    
    
  
  
    
    
    
    
  
  
    
    
    
  
  
    
    
    
  
  
    ...°
    ]
  
  
    
    
    
  
  
    
    
    
    
    
  
  
    
    
    
  
  
    
    
  
  
    
    
    
  
  
    
    
    
  

UMlet

what is

UMLet is a free, open-source UML tool with a simple user interface: draw UML diagrams fast, build sequence and activity diagrams from plain text, export diagrams to eps, pdf, jpg, svg, and clipboard, share diagrams using Eclipse, and create new, custom UML elements. UMLet runs stand-alone or as Eclipse plug-in on Windows, OS X and Linux.

kroki-umlet

State machine

This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!This Element has an Error!