You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support all the diagrams as code with https://kroki.io/. They provide a free service, but we can self-host if necessary.
This can be in a separate package @codewars/marked-kroki.
The implementation is as simple as:
import{deflate}from'pako';constkroki=(base='https://kroki.io')=>{if(base.endsWith('/'))base=base.slice(0,-1);return{code(code,language){// TODO Support options. `{name} ?foo=1&bar=2`// TODO Support captions and alt textif(diagramTypes.has(language)){constu8=deflate(code,{level: 6});constdata=base64(String.fromCharCode.apply(null,u8));return`<img src="${base}/${language}/svg/${data}">`;}returnfalse;}};};// Base64 URL safeconstbase64=(s)=>btoa(s).replace(/\//g,'_').replace(/\+/g,'-');// All supported typesconstdiagramTypes=newSet(['graphviz','blockdiag','seqdiag','actdiag','nwdiag','packetdiag','rackdiag','mermaid','ditaa','svgbob','erd','plantuml','c4plantuml','nomnoml','umlet','vega','vegalite','bpmn','wavedrom','bytefield','excalidraw','pikchr','structurizr',]);
Support all the diagrams as code with https://kroki.io/. They provide a free service, but we can self-host if necessary.
This can be in a separate package
@codewars/marked-kroki
.The implementation is as simple as:
Input:
Output:
The text was updated successfully, but these errors were encountered: