New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

html-store

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-store

ERROR: No README.md file found!

latest
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

html-store

Document-oriented key-value storage in an HTML file. Built for jsbin.

Install

npm install html-store

Basic usage

To begin, create a new file and initiliase it with some base HTML. html-store does its best to preserve this original HTML.

var htmlstore = require('html-store');

var file = Object.create(htmlstore.file);

file.init('<!doctype html>\n<title>Hello!</title>\n<h1>Hello, world!</h1>');

Now you can add some data (.set) and meta-data (.meta).

file.set({
  markdown: '# Hello, world!',
  less: 'body { h1 { color: red; } }'
});

file.meta({
  description: 'My nice page.'
});

Render

To get a rendered output, use .render:

var html = file.render();

The output of the above is:

<!doctype html>
<title>Hello!</title>
<meta name="description" content="My nice page.">

<h1>Hello, world!</h1>

<script type="text" data-name="markdown">
# Hello, world!
</script>

<script type="text" data-name="less">
body { h1 { color: red; } }
</script>

Parse

You can get data back from a rendered (or manually modified) HTML file using htmlstore.parse:

var newFile = htmlstore.parse(html);

The file object you'll get is:

{ metadata: { description: 'My nice page.' },
  data:
   { markdown: '# Hello, world!',
     less: 'body { h1 { color: red; } }' },
  raw: '<!doctype html>\n><title>Hello!</title>\n<h1>Hello, world!</h1>' }

License

MIT

FAQs

Package last updated on 31 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts