[](https://www.npmjs.com/package/fa-diagrams) [](https://travis-ci.org/Klemek/fa-diagrams) [](https://coveralls.io/github/Klemek/fa-diagrams?branch=master) # (WIP) fa-diagrams ## SVG diagrams built from Font-Awesome icons **[Demo](https://klemek.github.io/fa-diagrams)** ## RoadMap to v1 * [x] Font-Awesome paths scrapping in build * [x] Node placing with links * [x] SVG output * [x] Node's icon rendering * [x] Simple links rendering * [x] Dashed links rendering * [x] Colors * [x] Sub-texts * [x] Font styles * [ ] Sub-icons * [ ] More options * [ ] Unit testing ## Summary * [Install](#install) * [CDN](#cdn) * [Static scripts](#static-scripts) * [NPM](#npm) * [Build from sources](#build-from-sources) * [Usage](#usage) * [Node module](#node-module) * [Html script](#html-script) * [API](#api) * [`options`](#options) * [`nodes`](#nodes) * [`links`](#links) * [Sub-elements](#sub-elements) * [More info](#more-info) * [Icon names](#icon-names) * [Link types](#link-types) * [Thrown errors](#thrown-errors) * [Change icons](#change-icons) * [Examples](#examples) ## Install *[back to top](#top)* ### Static scripts Get the scripts from this repository `dist` folder ```html ``` ### CDN (soon) ```html ``` or ```html ``` ### NPM (soon) ``` npm install fa-diagrams ``` ### Build from sources You will need subversion installed (used for precise folder fetching in GitHub) ``` git clone https://github.com/klemek/fa-diagrams.git cd fa-diagrams npm install node build.sh ``` ## Usage *[back to top](#top)* ### Node module ```javascript const faDiagrams = require('fa-diagrams'); const data = { nodes: [ { name: 'node1', icon: 'laptop-code', color: '#4E342E', bottom: 'my app', }, { name: 'node2', icon: 'globe', color: '#455A64', bottom: 'world' } ], links: [ { from: 'node1', to: 'node2', color: '#333333', bottom: '"hello"' } ] }; const svg = faDiagrams.compute(data); // string containing xml data //export as SVG with fs const fs = require('fs'); fs.writeFileSync('diagram.svg', svg, {encoding:'utf-8'}); //export as PNG with svg2img (npm i svg2img) const svg2img = require('svg2img'); svg2img(svg, function(error, buffer) { fs.writeFileSync('diagram.png', buffer); }); ``` Will produce the following diagram:  ### Html script ```html
... ... ... ...