Nodebook
  • Introduction
  • Methods
  • Default Classes
    • Nodebook
  • JS
    • JSONotebook
    • JSNotebook
    • TSNotebook
  • Java
    • JavaNotebook
  • C/C++
    • CPPNotebook
    • CNotebook
    • HeaderNotebook
  • Text
    • TXTNotebook
    • MDNotebook
    • PlainNotebook
  • Web
    • HTMLNotebook
    • CSSNotebook
      • CSSStyle
  • Other
    • YMLNotebook
    • BashNotebook
  • Python
    • PYNotebook
Powered by GitBook
On this page
  • Usage
  • Setup

Was this helpful?

  1. Text

MDNotebook

extends Nodebook

"MDNotebook" is a special class used for .md (Markdown) files.

Usage

Setup

const Nodebook = require('nodejs-notebook');

const readme = new Nodebook.MDNotebook('README');

note(value)

Similar to addLine() but it does not automatically create an indent.

value: The value to add in the markdown file. Can be anything. Required

readme.note('Welcome to Project!');

createHeader(value, options)

Creates a header inside the file.

string value: The value that the header will be. Required

object options:

  • options.type: The type of header to add. Defaults to h1.

readme.createHeader('Installation');
// Adds a h1 called "Installation"

readme.createHeader('Usage', { type: '2'});
// Adds a h2 called "Usage"

readme.createHeader('About Us', { type: 3 });
// Adds a h3 called "About Us"

// Notice how both numbers and number strings are supported...

createLink(url, text)

Creates a link inside the markdown file.

string url: The URL that the link points to. Required

text: The text that, when clicked redirects to the URL. Optional.

readme.createLink('https://docs.myproject.com');
// Creates a link that redirects to that URL with that URL showing.

readme.createLink('https://docs.myproject.com', 'Docs');
// Creates a link that redirects to that URL with 'Docs' showing.

createList(list, options)

Creates a list inside the markdown file.

array list: An array of items to be added to the list.

object options:

  • options.type: The type of list. If unordered, list starts with a • . If ordered, list goes up numerically. Defaults to unordered.

readme.createList(['Head Author: Alex', 'Co-Author: James'], { type: 'unordered'})
// Creates an unordered list with the array contents

readme.createList(['Usage', 'Introduction', 'Installation'], { type: 'ordered'});
// Creates an ordered list with the array contents
PreviousTXTNotebookNextPlainNotebook

Last updated 4 years ago

Was this helpful?