@dhlx/vitepress-plugin-drawio
v0.0.10
Published
vitepress plugin for drawio
Downloads
108
Readme
vitepress-plugin-drawio
A VitePress plugin for rendering drawio diagrams.
Installation
npm install @dhlx/vitepress-plugin-drawioUsage
set the drawioPlugin in the vitepress.config.ts file.
// .vitepress/config.ts
import { defineConfig } from 'vitepress'
import withDrawio from '@dhlx/vitepress-plugin-drawio'
export default withDrawio(defineConfig({
}), {
// default page
// set default width, default: 100%
width: "100%",
// set default height,default: 600px
height: "600px",
// start page 0
page: 0,
// set page title
// dark mode,default: auto, options: light, dark, auto
"darkMode": "auto",
// enable toolbar resize,default: false
resize: true,
// enable toolbar change pages,default: false
pages: true,
// enable toolbar zoom,default: false
zoom: true,
// enable toolbar layers,default: false
layers: true,
// enable toolbar lightbox,default: false
lightbox: true,
// set highlight color,default: #0000FF
highlight: "#0000ff",
// set transparent background,default: false
transparent: true,
})
Example
{edit=_blank transparent=true nav=true }{} is the attribute of the drawio diagram. You can set the attribute in the vitepress.config.ts file.
if you set the transparent=true,the background will be transparent.
other attribute will be override the vitepress.config.ts file.

drawio export embed html
<div class="mxgraph" style="max-width:100%;border:1px solid transparent;" data-mxgraph="{"highlight":"#0000ff","nav":true,"resize":true,"toolbar":"zoom layers tags lightbox","edit":"_blank","xml":"<mxfile host=\"drawio-plugin\" modified=\"2025-06-27T13:24:57.413Z\" agent=\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36\" etag=\"7LfbhlVYnnBihQg1IvBB\" version=\"22.1.22\" type=\"embed\">\n <diagram id=\"qkP3y_bxUUfVqNj_0rsu\" name=\"Page-1\">\n <mxGraphModel dx=\"1021\" dy=\"271\" grid=\"1\" gridSize=\"10\" guides=\"1\" tooltips=\"1\" connect=\"1\" arrows=\"1\" fold=\"1\" page=\"1\" pageScale=\"1\" pageWidth=\"850\" pageHeight=\"1100\" math=\"0\" shadow=\"0\">\n <root>\n <mxCell id=\"0\" />\n <mxCell id=\"1\" parent=\"0\" />\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-15\" value=\"\" style=\"swimlane;startSize=0;\" parent=\"1\" vertex=\"1\">\n <mxGeometry x=\"-755\" y=\"560\" width=\"705\" height=\"295\" as=\"geometry\">\n <mxRectangle x=\"-750\" y=\"530\" width=\"660\" height=\"240\" as=\"alternateBounds\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"8\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;startArrow=classic;startFill=1;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" source=\"R3OlMqQ6P8qwzzm3plWy-11\" target=\"R3OlMqQ6P8qwzzm3plWy-12\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"9\" value=\"&lt;font style=&quot;font-size: 12px;&quot;&gt;Watch/compile&lt;/font&gt;\" style=\"edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];\" parent=\"8\" vertex=\"1\" connectable=\"0\">\n <mxGeometry x=\"-0.2242\" y=\"-3\" relative=\"1\" as=\"geometry\">\n <mxPoint as=\"offset\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"10\" value=\"\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.353;entryY=0.958;entryDx=0;entryDy=0;entryPerimeter=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" source=\"R3OlMqQ6P8qwzzm3plWy-11\" target=\"R3OlMqQ6P8qwzzm3plWy-10\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\">\n <mxPoint x=\"200\" y=\"95\" as=\"targetPoint\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-11\" value=\"webpack\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" vertex=\"1\">\n <mxGeometry x=\"82.5\" y=\"150\" width=\"235\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"11\" style=\"edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" source=\"R3OlMqQ6P8qwzzm3plWy-10\" target=\"R3OlMqQ6P8qwzzm3plWy-12\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"12\" value=\"watch\" style=\"edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];\" parent=\"11\" vertex=\"1\" connectable=\"0\">\n <mxGeometry x=\"0.1055\" y=\"-4\" relative=\"1\" as=\"geometry\">\n <mxPoint as=\"offset\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-10\" value=\"webpack-dev-server&lt;br&gt;webpack-dev-middleware\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#58E0EF;fontColor=#000000;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" vertex=\"1\">\n <mxGeometry x=\"20\" y=\"30\" width=\"510\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-12\" value=\"File/module changed\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" vertex=\"1\">\n <mxGeometry x=\"487\" y=\"150\" width=\"180\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"18\" value=\"1\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" vertex=\"1\">\n <mxGeometry x=\"365\" y=\"130\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"21\" value=\"2\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" vertex=\"1\">\n <mxGeometry x=\"155\" y=\"110\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"22\" value=\"3\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-15\" vertex=\"1\">\n <mxGeometry x=\"585\" y=\"80\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-13\" value=\"\" style=\"swimlane;startSize=0;fillColor=none;rounded=0;shadow=0;glass=1;swimlaneLine=0;\" parent=\"1\" vertex=\"1\">\n <mxGeometry x=\"-760\" y=\"100\" width=\"710\" height=\"330\" as=\"geometry\">\n <mxRectangle x=\"-760\" y=\"100\" width=\"670\" height=\"290\" as=\"alternateBounds\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"25\" style=\"edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" source=\"2\" target=\"6\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"2\" value=\"webpack-dev-server/client\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#58E0EF;fontColor=#000000;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"10\" y=\"140\" width=\"220\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"27\" style=\"edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" source=\"6\" target=\"R3OlMqQ6P8qwzzm3plWy-6\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"39\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" source=\"6\" target=\"R3OlMqQ6P8qwzzm3plWy-8\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"6\" value=\"webpack/hot/&lt;br&gt;dev-server\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"280\" y=\"140\" width=\"110\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"31\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.71;exitY=0;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.452;entryY=0.967;entryDx=0;entryDy=0;entryPerimeter=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" source=\"R3OlMqQ6P8qwzzm3plWy-7\" target=\"R3OlMqQ6P8qwzzm3plWy-6\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\">\n <mxPoint x=\"462\" y=\"236.51999999999998\" as=\"sourcePoint\" />\n <mxPoint x=\"460\" y=\"110\" as=\"targetPoint\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-7\" value=\"JsonpMain Template Runtime\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"320\" y=\"240\" width=\"200\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"29\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" source=\"R3OlMqQ6P8qwzzm3plWy-6\" target=\"R3OlMqQ6P8qwzzm3plWy-7\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"37\" style=\"edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" source=\"R3OlMqQ6P8qwzzm3plWy-6\" target=\"R3OlMqQ6P8qwzzm3plWy-8\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-6\" value=\"HotModuleReplacement&lt;br&gt;Runtime\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"367\" y=\"42\" width=\"210\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-8\" value=\"App/updated\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=none;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"580\" y=\"140\" width=\"120\" height=\"60\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"15\" value=\"4\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"80\" y=\"270\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"26\" value=\"5\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"240\" y=\"125\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"28\" value=\"6\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"300\" y=\"80\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"30\" value=\"7\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"426\" y=\"120\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"38\" value=\"10\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"600\" y=\"60\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"41\" value=\"11\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"R3OlMqQ6P8qwzzm3plWy-13\" vertex=\"1\">\n <mxGeometry x=\"500\" y=\"135\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"13\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=1;entryDx=0;entryDy=0;\" parent=\"1\" target=\"2\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\">\n <mxPoint x=\"-696\" y=\"590\" as=\"sourcePoint\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"14\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;\" parent=\"1\" source=\"2\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\">\n <mxPoint x=\"-640\" y=\"590\" as=\"targetPoint\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"R3OlMqQ6P8qwzzm3plWy-9\" value=\"Socket\" style=\"rounded=1;whiteSpace=wrap;html=1;fillColor=#58E0EF;fontColor=#000000;strokeColor=none;\" parent=\"1\" vertex=\"1\">\n <mxGeometry x=\"-720\" y=\"480\" width=\"110\" height=\"50\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"33\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.678;entryY=0.041;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=classic;startFill=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;\" parent=\"1\" source=\"R3OlMqQ6P8qwzzm3plWy-7\" target=\"R3OlMqQ6P8qwzzm3plWy-10\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\">\n <mxPoint x=\"-390\" y=\"410\" as=\"sourcePoint\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"34\" value=\"8\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"1\" vertex=\"1\">\n <mxGeometry x=\"-430\" y=\"500\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"35\" style=\"rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.678;entryY=0.041;entryDx=0;entryDy=0;entryPerimeter=0;startArrow=classic;startFill=1;exitX=0.71;exitY=1.055;exitDx=0;exitDy=0;exitPerimeter=0;\" parent=\"1\" source=\"R3OlMqQ6P8qwzzm3plWy-7\" edge=\"1\">\n <mxGeometry relative=\"1\" as=\"geometry\">\n <mxPoint x=\"-297\" y=\"420\" as=\"sourcePoint\" />\n <mxPoint x=\"-297\" y=\"594\" as=\"targetPoint\" />\n </mxGeometry>\n </mxCell>\n <mxCell id=\"36\" value=\"9\" style=\"ellipse;whiteSpace=wrap;html=1;aspect=fixed;fillColor=#60a917;fontColor=#FFFFFF;strokeColor=#2D7600;fontStyle=1;fontSize=16;\" parent=\"1\" vertex=\"1\">\n <mxGeometry x=\"-332.5\" y=\"500\" width=\"30\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"42\" value=\"jsonp\" style=\"text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;\" parent=\"1\" vertex=\"1\">\n <mxGeometry x=\"-290\" y=\"500\" width=\"50\" height=\"30\" as=\"geometry\" />\n </mxCell>\n <mxCell id=\"43\" value=\"manifest\" style=\"text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;\" parent=\"1\" vertex=\"1\">\n <mxGeometry x=\"-460\" y=\"460\" width=\"70\" height=\"30\" as=\"geometry\" />\n </mxCell>\n </root>\n </mxGraphModel>\n </diagram>\n</mxfile>\n"}"></div>