HTMLNotebook
extends Nodebook
"HTMLNotebook" is used for .html
files.
Usage
Setup
const Nodebook = require('nodejs-notebook');
const index = new Nodebook.HTMLNotebook('index');
setTitle(title)
Sets the <title>
keyword in <head>
.
string title
: The value for the <title>
element.
index.setTitle('My Blog'); // <title> now has the value 'My Blog'
setMeta(property, content)
Adds/Sets a Metadata (<meta>
)property to a content
string property
: The property of the <meta>
.
string content
: The content of the <meta>
.
index.setMeta('ogp:title', 'The Blog of the Century');
setLink(rel, href)
Adds/Sets a Link (<link>
)'s relationship (rel) to a value (href)
string rel
: The relationship of the link to the href.
string href
: The href (value) of the link.
index.setLink('stylesheet', 'styles/main.css');
addElement(element, value, inBody, selfClose, style, styleclass, styleid, spaces)
Creates an element, with provided options.
string element
: The element name. Will be shown between the <>
.
string value
: The element's value. Will be between the starting and finish element. If selfClose
is set to true, this will be the href
.
optional
boolean inBody
: Whether or not to put the element inside the <body>
element. If false, will be put after the </body>
. Defaults to true
.
optional
boolean selfClose
: Whether or not the element will self close. If true, an element will not have the /
closing version and the value
will be set as the href
. Defaults to false
.
optional
string style
: Style parameter for the element. Set to null
or leave blank for no style.
optional
string styleclass
: The Class the element is in. Set to null
or leave blank for no class.
optional
string styleid
: The ID the element has. Set to null
or leave blank for no ID.
optional
integer spaces
: The amount of spaces the element will put in before typing.
index.addElement('p', 'This morning I had some coffee!');
index.addElement('p', 'What did you have this morning?', true, false, 'font-weight: bold;');
index.addElement('img', 'https://welovecatsandkittens.com/wp-content/uploads/2017/03/likes.jpg', true, true);
index.addElement('h4', 'My favorite kitten picture', true, false, 'color: light_gray;', 'image-footer', null, 6);
Last updated
Was this helpful?