0.0.5 • Published 3 years ago

pikchr v0.0.5

Weekly downloads
20
License
0BSD
Repository
github
Last release
3 years ago

Pikchr - Diagram renderer

Actions Status Actions Status

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.

1: https://en.wikipedia.org/wiki/Pic_language

2: https://spec.commonmark.org/0.29/#fenced-code-blocks

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 attribute
  • dark_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 diagrams
  • text_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.

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago