1.0.2 • Published 8 years ago

@ceephax/document v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

HTML page generator

This is my most simplest html generator.

This is used by myself to generate documents for clients.

Below is an example setup package.json of how I use it to generate HTML files from markdown

{
  "name": "one-time-document",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "build": "document"
  },
  "document": {
    "title": "document title",
    "filename": "document.md",
    "template": "template.html"
  },
  "dependencies": {
    "@ceephax/document": "~1.0.0"
  }
}

There are 3 configurations found in document:

Filename

This is markdown and is what will be generated into the template

Template

The template used to create the document it should look like the following, it could be added to, to create custom styling:

<!DOCTYPE html>
<html>
	<head>
		<title>{{ title }}</title>
	</head>
	<body>
		{{ version }}

		{{{ html }}}
	</body>
</html>

Folder structure

This is an example of what your folder structure should look like:

├── document.md
├── package.json
└── template.html

Output

Running npm build will generate a index.html file in the root of the project.

Usage

I usually use it with the package html-pdf, to generate a PDF file out of the index.html.

Here is an example of the package.json to achieve that:

{
  "name": "one-time-document",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "document && html-pdf index.html $npm_package_name.$npm_package_version.pdf"
  },
  "document": {
    "title": "document title",
    "filename": "document.md",
    "template": "template.html"
  },
  "dependencies": {
    "@ceephax/document": "~1.0.0",
    "html-pdf": "^2.2.0"
  }
}
1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago