Skip to content

@beoe/rehype-gnuplot

Rehype plugin to generate Gnuplot diagrams in place of code fences. Example:

Installation

Terminal window
npm i @beoe/rehype-gnuplot

Usage

import rehypeGnuplot from "@beoe/rehype-gnuplot";
const html = await unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeGnuplot, {
/* options */
})
.use(rehypeStringify)
.process(`markdown`);

Check out other options.

Configuration

You probaly want to use file strategy. This tool doesn’t support dark scheme.

Bonus: XKCD-style

Example taken here.

Note: In order for the example to work as SVG, I changed the following lines:

set term postscript eps font 'HumorSans' fontfile 'Humor-Sans.pfa' 22
set output 'xkcd.eps'
set terminal svg enhanced font "HumorSans,Patrick Hand,Chalkboard,Comic Sans MS,18"

You may use any font you like and load it via CSS, for example: