GithubHelp home page GithubHelp logo

htmlbook.js's Introduction

htmlbook.js

Converts Markdown to HTMLBook.

Installation

Install with npm: npm install -g htmlbook

Usage

Node.js

Within Node, htmlbook.js works on strings.

var htmlbook = require('htmlbook');
var htmlbook_output = htmlbook("source content").parse();

To use htmlbook.js with a file, in Node.js do the following:

var fs = require('fs');
var htmlbook = require('htmlbook');

var htmlbook_output;

fs.readFile('path/to/file.md', 'utf-8', function (error, data) {
  if (error)
    return error;

  htmlbook_output = htmlbook(data).parse();
})

Command Line

$ htmlbook -s SOURCE_FILE -o OUTPUT_FILE

Additionally, type $ htmlbook --help for all options.

Options

Below is a list of available options, default value is emphasized.

  • fragment: false or true
  • level: chapter or book
  • debug: boolean -- default for command line is 'false'

Testing

There are two suites of tests for this repository. The first is spec/htmlbook_spec.js and tests the package for expected output. Run this test with the following:

$ jasmine-node spec/htmlbook_spec.js

The second test suite checks to be sure that the file being tested in htmlbook_spec are in fact being output to valid HTMLBook. It's no use writing tests that pass unless they pass on valid output. These tests are separated because the validation takes longer.

$ jasmine-node spec/validation_spec.js

htmlbook.js's People

Watchers

JT5D avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.