htm

htmltoenml

HTML To ENML Converter for Node.js

Showing:

Popularity

Downloads/wk

0

GitHub Stars

3

Maintenance

Last Commit

6yrs ago

Contributors

4

Package

Dependencies

6

License

GPL-3.0-or-later

Type Definitions

Tree-Shakeable

No?

Categories

Readme

node-htmltoenml

node-htmltoenml is a node.js module to convert HTML to ENML (Evernote Markup Language).

Unlike other implementations, htmltoenml parses the DOM tree of the HTML document and converts it to valid ENML, which results in a robust and reliable conversion

Usage

Install htmltoenml via npm:

    npm install htmltoenml

Call htmltoenml from a node.js script as follows:

    var htmltoenml = require('htmltoenml');

    options = {
      baseUrl: 'http://www.google.com', // Base url for relative URLs,
                                        //     default is ''.
      strict: true,                     // In strict mode, converter returns
                                        //     error when encountering invalid
                                        //     resources or invalid HTML tags.
                                        //     When strict is set to false,
                                        //     it discards invalid elements.
                                        //     Default is false.
      includeComments: false,           // Default is false
      ignoreFiles: false                // If ignoreFiles flag is set, files
                                        //      are not converted to Evernote
                                        //      resources. Default is false.
    }

    htmltoenml.fromString(htmlString, options, function(err, enml, resources) {
      if (err) {
        // handle conversion error
        console.error(err);
      } else {
        // Your ENML string:
        console.log(enml, resources);
      }
    }) ;

    htmltoenml.fromFile('path/to/your/file.html', options, function(err, enml, resources) {
      if (err) {
        // handle conversion error
        console.error(err);
      } else {
        // Your ENML string:
        console.log(enml, resources);
      }
    }) ;

Features

  • en-media tag support, with download and calculation of MD5 Hash(hash attribute) and mime-type(type attribute)
  • validates converted ENML against ENML DTD
  • case-insensitive tag and attribute conversions
  • DOM based tag scanning and replacement

License

GPLv3

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial