pikchr
v0.0.5
Published
Pikchr addon source package
Downloads
59
Readme
Pikchr - Diagram renderer
Taken from the pikchr homepage:
Pikchr (pronounced like "picture") is a PIC-like markup language for diagrams in technical documentation. Pikchr is designed to be embedded in fenced code blocks of Markdown (or in similar mechanisms in other markup languages) to provide a convenient means of showing diagrams.
This is the source version addon for nodejs. It uses node's NAPI which makes it compatible with many node versions.
You can use it as follows:
const pikchr = require('pikchr');
pikchr.pikchr('line ; box "Hello," "World!"; arrow') // -> svg string
pikchr.pikchrex('line ; box "Hello!"', options={}) // -> result object
Where allowed options
are:
class_name
: a string for root svg's class attributedark_mode
: when this flag is used, Pikchr inverts the colors in the diagram to make them suitable for "dark mode" pages. The main Pikchr website has a dark-mode counterpart that you can visit to see the effects of this flag on Pikchr diagramstext_errors
: mormally, the text returned by pikchr in the event of an error is formatted as HTML. Setting this flag causes the error message to be plain text
text_errors
and dark_mode
must be booleans and class_name
a string.
All of them are optional.
Check flags passed to pikchr in pikchr documentation for more detailed information.