drawdown-svg-render

2.0.1 • Public • Published

Drawdown Svg Render

D3 based renderer which renders parsed drawdown diagrams.

Installation

$ npm install drawdown-svg-render --save

Usage

In order to use the renderer we need to parse our drawdown script into an object representation. We can achieve this by using the drawdown parser package

$ npm install drawdown-parser

Once we have all dependencies installed, we can do:

import { factory } from 'drawdown-parser';
import { Renderer } from 'drawdown-svg-render';

let script = `- Hello.
- Do you like diagrams?
- Yes:
  - You are cool.
- No:
  - You need some coffee.`

let diagramObject = factory('flow').parseText(script);
let renderer = new Renderer();
renderer.render(document.body, diagramObject);

This will render interactive SVG diagram editor into the body of our HTML document. The editor will contain a diagram which will look something like this:

Example diagram

The editor will let us pan and zoom the diagram, move the nodes around and define the style of the arrows.

The actual look of the diagram will depend highly on our CSS rules. The Renderer itself does not provide any styling.

API

Sorry. It is in TODO.

Demo

Sorry. It is in TODO also.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.152latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.152
2.0.00
1.5.20
1.5.10
1.5.00
1.4.00
0.3.00
0.2.00
0.1.00

Package Sidebar

Install

npm i drawdown-svg-render

Weekly Downloads

52

Version

2.0.1

License

ISC

Unpacked Size

193 kB

Total Files

13

Last publish

Collaborators

  • lyubo.slavilov