html-dom-parser
Advanced tools
Comparing version 0.1.3 to 0.2.0
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
The format is based on [Keep a Changelog](http://keepachangelog.com) | ||
and this project adheres to [Semantic Versioning](http://semver.org). | ||
# [0.2.0](https://github.com/remarkablemark/html-dom-parser/compare/v0.1.3...v0.2.0) (2019-04-01) | ||
### Features | ||
* **types:** add TypeScript decelerations ([b52d52f](https://github.com/remarkablemark/html-dom-parser/commit/b52d52f)) | ||
## [0.1.3](https://github.com/remarkablemark/html-dom-parser/compare/v0.1.2...v0.1.3) - 2018-02-20 | ||
@@ -9,0 +15,0 @@ ### Fixed |
{ | ||
"name": "html-dom-parser", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "An HTML to DOM parser that works on the server and client.", | ||
"author": "Mark <mark@remarkablemark.org>", | ||
"main": "index.js", | ||
"types": "types", | ||
"scripts": { | ||
"prepublish": "npm run clean && npm run build", | ||
"clean": "rm -rf dist", | ||
"build": "npm run build:min && npm run build:unmin", | ||
"build:min": "webpack index.js dist/html-dom-parser.min.js -p --output-library HTMLDOMParser --output-library-target umd", | ||
"build:unmin": "webpack index.js dist/html-dom-parser.js --output-library HTMLDOMParser --output-library-target umd", | ||
"test": "mocha", | ||
"clean": "rm -rf dist", | ||
"cover": "istanbul cover _mocha -- -R spec", | ||
"coveralls": "cat coverage/lcov.info | coveralls", | ||
"dtslint": "dtslint types", | ||
"lint": "eslint . --ignore-path .gitignore", | ||
"cover": "istanbul cover _mocha -- -R spec", | ||
"coveralls": "cat coverage/lcov.info | coveralls" | ||
"prepublish": "npm run clean && npm run build", | ||
"release": "standard-version --no-verify", | ||
"test": "mocha" | ||
}, | ||
@@ -36,4 +39,6 @@ "repository": { | ||
"devDependencies": { | ||
"@types/domhandler": "^2.4.1", | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.11.14", | ||
"dtslint": "^0.5.9", | ||
"eslint": "^3.4.0", | ||
@@ -44,2 +49,3 @@ "html-minifier": "^3.1.0", | ||
"mocha": "^3.4.2", | ||
"standard-version": "^5.0.2", | ||
"webpack": "^2.6.1" | ||
@@ -46,0 +52,0 @@ }, |
@@ -10,14 +10,24 @@ # html-dom-parser | ||
An HTML to DOM parser that works on both the server and client. | ||
An isomorphic HTML to DOM parser: | ||
``` | ||
Parser(string[, options]) | ||
``` | ||
The parser converts an HTML string to a JavaScript object that describes the DOM tree. | ||
[repl.it](https://repl.it/@remarkablemark/html-dom-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/ff9yg1yz/) | ||
## Installation | ||
NPM: | ||
[NPM](https://www.npmjs.com/package/html-dom-parser): | ||
```sh | ||
npm install --save html-dom-parser | ||
``` | ||
[Yarn](https://yarnpkg.com/package/html-dom-parser): | ||
```sh | ||
$ npm install html-dom-parser | ||
yarn add html-dom-parser | ||
``` | ||
CDN: | ||
[CDN](https://unpkg.com/html-dom-parser/): | ||
```html | ||
@@ -29,2 +39,3 @@ <script src="https://unpkg.com/html-dom-parser@latest/dist/html-dom-parser.js"></script> | ||
Import parser: | ||
```js | ||
@@ -36,8 +47,10 @@ // server | ||
var Parser = window.HTMLDOMParser; | ||
``` | ||
Parse input: | ||
```js | ||
Parser('<p>Hello, world!</p>'); | ||
``` | ||
Output: | ||
Return output: | ||
```js | ||
@@ -58,3 +71,3 @@ [ { type: 'tag', | ||
The server parser is a wrapper of [htmlparser2](https://github.com/fb55/htmlparser2)'s `parseDOM()` and the client parser uses the browser's [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction) API to mimic the output of the server parser. | ||
The server parser is a wrapper of [htmlparser2](https://github.com/fb55/htmlparser2)'s `parseDOM()` and the client parser uses the browser's [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model/Introduction) API to mimic the output of the server parser. | ||
@@ -61,0 +74,0 @@ ## Testing |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73319
20
848
80
11