1.0.1 • Published 5 years ago

zeichen v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Zeichen

Zeichen is a Javascript package to create documentation from code. Create an instance with:

const Zeichen = require("zeichen");
var zc = new Zeichen();

How to Create Documentation

So far you can create text, which is just plain text and must be the innermost text-containing element inside every other element, no matter how many nested elements there are, headers, syntax-highlighted code blocks, and links.

zc.newText("some text to be put into the element"); // text
zc.newHeader(zc.newText("the text"), 3); // the second argument is the size (this would be h3 in HTML)
zc.newCode(zc.newText("console.log('Hello world!');"), "javascript"); // code block with javascript syntax highlighting (only for markdown)
zc.newLink(zc.newText("Link label text"), "http://google.com/"); // creates a link - if the second argument is not defined then the link text is the url

To add an element to the item that the instance displays use zc.addElement:

zc.addElement(zc.newText("this is a text element but any other element could go here too"));

How to See Your Documentation

note - code blocks have inconsistent representation in HTML form

zc.markdown() //=> returns the markdown representation of an instance
zc.html() //=> returns the html representation of an instance
zc.display() //=> starts a server to see the html representation of an instance quickly