Goldmark extension for rendering pikchr diagrams. Heavily copied from github.com/abhinav/goldmark-mermaid. Uses gopikchr for translating pikchr diagrams to svg.
A simple pikchr diagram:
```pikchr
box color red wid 2.6in \
"Click on any diagram on this page" big \
"to see the Pikchr source text" big
```
The pikchr plugin supports the following attributes:
toggle(defaultfalse): iftrue, add javascript to the page to toggle between the diagram and its source when it is clicked.limitwidth(defaulttrue): iftrue, add amax-widthstyle limiting the maximum width of the<div>containing the<svg>element to the width of the diagram. This prevents it from getting scaled up.
Add a &pikchr.Extender{} to the list of goldmark extensions:
gm := goldmark.New(goldmark.WithExtensions(&pikchr.Extender{}))If you wish to use the toggle attribute, add the following snippet to your css:
.hidden {
position: absolute !important;
opacity: 0 !important;
pointer-events: none !important;
display: none !important;
}- Enable click-to-toggle-source as on pikchr.org examples
- Add a
toggleparameter to the pikchr blocks, so toggling source can be turned on or off per block - Add a
limitwidthparameter so thatmax-widthstyling can be turned off.