Table of Contents 1 Overview 1.1 reference 1.2 configuration and related preparations 1.2.1 language Settings 1.2.2 No security prompts 1.2.3 establish Yas Shortcut 1.2.4 Jar package path Settings 1.2.5 Preview Image 2 ditaa2.1 Reference 2.2 Implementation principle 2.3 DITAA use Description 2.4 Example 3 graphviz3.1 example 4 plantuml4.1 configuration 4.2 Example 5 acknowledgements overview Org drawing has the following related modules Artist-mode/picture-mode: generating ASCII graphs DITAA: Generating pictures from ASCII graphs Graphviz: Build diagram plantuml: Build UML diagram based on Graphiz when Org-mode is used, #+begin_src #+end_src tags can be used to generate PLANTUML Diagram Reference Bernt hansen:org mode-organize Your Life in Plain text configuration and related preparation language Settings Org-babel-load-languages variable additions allow language settings, Ditaa is t (org-babel-do-load-languages ' org-babel-load-languages ' (;; other Babel languages (Ditaa. T) (PLANTUML. t) (dot t) (xxx. T)) After this setting, the #+begin_src ditaa:file some_filename.png:cmdline-r-S 0.8#+BEGIN_SRC can be called as follows Plantuml:file Export-file-name:cmdline-charset UTF-8 If the above settings are not set, the BEGIN_SRC will not succeed and need to be called as follows: #+begin_ditaa Test.png- R-s 0.8 do not prompt for security prompts when generating images (setq org-confirm-babel-evaluate Nil) Establish Yas shortcut keys DITA#+BEGIN_SRC ditaa:file ${1: Export-file-name}: Cmdline-r-S 0.8 ${0}#+end_src DOT#+BEGIN_SRCDot:file ${1:export-file-name}.png:cmdline-kdot-tpngtitle ${0}#+end_src uml#+begin_src plantuml:file ${1: Export-file-name}: Cmdline-charset utf-8title ${0}#+end_srcjar package path Setting (setq org-plantuml-jar-path (expand-file-name "~ /.emacs.d/scripts/plantuml.jar ")) (setq org-ditaa-jar-path (format"%s%s "(If *cygwin*" C:/cygwin "") (expand-file-name "~/.emacs.d/elpa/contrib/scripts/ditaa.jar")) ) Preview image (Add-hook ' Org-babel-after-execute-hook ' bh/display-inline-images ' append); Make Babel results blocks lowercase (setq org-babel-results-keyword "Results") (Defun bh/display-inline-images () ( Condition-case Nil (org-display-inline-images))) This time input c-c c-c generate image, c-c c-x c-v switch inline image display Ditaa reference ARTISTPI Cture Modeditaa SourceForge has very detailed documentation and examples Emacser:artist-mode picture text diagram Emacser:emacs drawing-Ditaa Chapter Emacser:emacs Drawing-Ditaa Chapter implementation principle first through Artist-mode or Picture-mode generates ASCII text, and then generates a picture by calling the Java package Ditaa.jar and inserting the picture into the HTML code. As the following example, the script that is actually called is Java-dfile.encoding=utf-8-jaR/path/ditaa.jar-r-S 0.8 c\:/users/admini\~1/appdata/local/temp/babel-124lpi/ditaa-124xjt e\:/gitroot/doc/org/ Share/emacs/ditaa_test.png Current version is 0.9DITAA use description parameter description paramlong paramdesc-e–encoding specify encoding-e–no-separation nested rectangles are delimited by default , set no-r–round-corners rounded rectangle-s–scale rectangle size, such as 0.8-o–overwrite if a file with the same name is overwritten-s–no-shadows-a–no-antialias-v–verbose-h– help-t–tabs-h–html Graphics rule Rounded rectangle: four vertices with/\ As graphics colorcxxx XXX indicates that RGB can also take a preset value: CRED cgre cblk cblu cpnk cyeltags inside the rectangle inner tag: {d} docu Ment{s} Storage{io} input/outputdashed lines dashed line::: Dashed line:: =* text within rectangle: o:: · Number Example #+begin_src ditaa:file test_ditaa.png:cmdline-r-S 0.8 +-----------+ +---------+ | PLC | | | | Network +<------>+ PLC +<---=---------+ | CRED | | c707 | | +-----------+ +----+----+ | ^ | | | | +----------------|-----------------+ | | | | V V V +----------+ +----+--+--+ +-------+---+ +-----+-----+ W indows Clients | | | | | | | | +----+ +----+ | Database +<----->+ Shared +<---->+ Executive +<-=-->+ Operator +<---->|cyel| . . .| cyel| | c707 | | Memory | | c707 | | Server | | | | | +--+----+--+ | {D} cgre | +------+----+ | c707 | +----+ +----+ ^ ^ +----------+ ^ +-------+---+ | | | | +--------=--------------------------+ v+--------+--------+| || Millwide System | --------Data---------| Cblu | --=-----Signals---=--+-----------------+#+END_SRC Generate Results http://images.cnitblog.com/blog/485361/201301/ 27161349-3c9f33a1613947078d7c1037246ba62a.jpggraphvizhomepage Current Version 2.28.0 example #+begin_src dot:file test_graphviz.png: Cmdline-kdot-tpngdigraph G {size= "8,6" Ratio=expand Edge [Dir=both] plcnet [Shape=box, label= "PLC Network"] Subgra ph Cluster_wrapline {label= "wrapline Control System" color=purple subgraph {rank=same exec sharedmem [ Style=filled, Fillcolor=lightgrey, Shape=box]} edge[style=dotted, Dir=none] exec, opserver exec, DB PLC, EXEC Edge [Style=line, Dir=both] exec, Sharedmem SHAREDMEM, DB plc, SHAREDMEM Sharedmem, Opserver} Plcnet plc [Constraint=false] millwide [Shape=box, label= "Millwide System"] db-- Millwide subgraph cluster_opclients {color=blue label= "Operator clients" RANKDIR=LR labelloc=b Node[label =client] Opserver, client1 opserver, Client2 opserver }}#+end_srchttp://images.cnitblog.com/blog/485361/201301/ 27161352-25d17a200fdf4b2c9049799d71dbf9df.jpgplantumlhomepage Current Version 7952 configuration example #+begin_src plantuml:file test_uml.png: Cmdline-charset utf-8title Example Sequence diagramactivate clientclient server:session initiationnote Right:clie NT requests New Sessionactivate serverclient <--server:authorization requestnote left:server requires authentication Client-Server:authorization responsenote right:client provides authentication Detailsserver-client:session Tokennote left:session establisheddeactivate serverclient client:saves tokendeactivate Client#+END_SRChttp:// Images.cnitblog.com/blog/485361/201301/27161355-092b3993d45c4577ab92050c1c052236.jpg Thank you for the Cnblogs plugin provided by Open Source , and very enthusiastic about the timely resolution of the issue of the transmission of pictures!
Turn the drawing in Emacs