{"_id":"hast-util-from-html","_rev":"3759759","name":"hast-util-from-html","description":"hast utility to parse from HTML","dist-tags":{"latest":"2.0.3"},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"time":{"modified":"2025-04-22T08:04:44.000Z","created":"2022-05-29T11:11:12.110Z","2.0.3":"2024-09-17T11:10:50.098Z","2.0.2":"2024-08-22T11:38:06.796Z","2.0.1":"2023-08-08T15:56:12.091Z","2.0.0":"2023-08-08T12:11:04.802Z","1.0.2":"2023-05-04T08:52:05.722Z","1.0.1":"2023-01-08T13:18:26.421Z","1.0.0":"2022-05-29T11:11:12.110Z"},"users":{},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"versions":{"2.0.3":{"name":"hast-util-from-html","version":"2.0.3","description":"hast utility to parse from HTML","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse","tokenize"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":"./index.js","dependencies":{"@types/hast":"^3.0.0","devlop":"^1.1.0","hast-util-from-parse5":"^8.0.0","parse5":"^7.0.0","vfile":"^6.0.0","vfile-message":"^4.0.0"},"devDependencies":{"@types/mdast":"^4.0.0","@types/node":"^22.0.0","c8":"^10.0.0","mdast-zone":"^6.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","remark-preset-wooorm":"^10.0.0","to-vfile":"^8.0.0","type-coverage":"^2.0.0","type-fest":"^4.0.0","typescript":"^5.0.0","unist-builder":"^4.0.0","xo":"^0.59.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["preset-wooorm",["remark-lint-no-html",false],"./script/parse-error.js"]},"typeCoverage":{"atLeast":100,"detail":true,"ignoreCatch":true,"strict":true},"xo":{"overrides":[{"files":["**/*.d.ts"],"rules":{"@typescript-eslint/array-type":["error",{"default":"generic"}],"@typescript-eslint/ban-types":["error",{"extendDefaults":true}],"@typescript-eslint/consistent-type-definitions":["error","interface"]}},{"files":"test/**/*.js","rules":{"no-await-in-loop":"off"}}],"prettier":true,"rules":{"unicorn/prefer-code-point":"off","unicorn/prefer-string-replace-all":"off"}},"_id":"hast-util-from-html@2.0.3","gitHead":"1ade8935dea8d293196f4cfc0463d3e91eb8a49e","types":"./index.d.ts","homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","_nodeVersion":"22.7.0","_npmVersion":"10.8.3","dist":{"shasum":"485c74785358beb80c4ba6346299311ac4c49c82","size":14589,"noattachment":false,"key":"/hast-util-from-html/-/hast-util-from-html-2.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/hast-util-from-html/download/hast-util-from-html-2.0.3.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-html_2.0.3_1726571449928_0.2745559112966989"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-09-17T11:10:50.098Z","publish_time":1726571450098,"_source_registry_name":"default","_cnpm_publish_time":1726571450098},"2.0.2":{"name":"hast-util-from-html","version":"2.0.2","description":"hast utility to parse from HTML","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse","tokenize"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":"./index.js","dependencies":{"@types/hast":"^3.0.0","devlop":"^1.1.0","hast-util-from-parse5":"^8.0.0","parse5":"^7.0.0","vfile":"^6.0.0","vfile-message":"^4.0.0"},"devDependencies":{"@types/mdast":"^4.0.0","@types/node":"^22.0.0","c8":"^10.0.0","mdast-zone":"^6.0.0","prettier":"^3.0.0","remark-cli":"^12.0.0","remark-preset-wooorm":"^10.0.0","to-vfile":"^8.0.0","type-coverage":"^2.0.0","type-fest":"^4.0.0","typescript":"^5.0.0","unist-builder":"^4.0.0","xo":"^0.59.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["preset-wooorm",["remark-lint-no-html",false],"./script/parse-error.js"]},"typeCoverage":{"atLeast":100,"detail":true,"ignoreCatch":true,"strict":true},"xo":{"overrides":[{"files":"test/**/*.js","rules":{"no-await-in-loop":"off"}}],"prettier":true,"rules":{"unicorn/prefer-code-point":"off","unicorn/prefer-string-replace-all":"off"}},"_id":"hast-util-from-html@2.0.2","gitHead":"21f345e62a20afe4ddbe2363aca186426afc3714","types":"./index.d.ts","homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","_nodeVersion":"22.0.0","_npmVersion":"10.8.2","dist":{"shasum":"e185911de8811b17bfd3d080ee9ee7466c1d63c4","size":14364,"noattachment":false,"key":"/hast-util-from-html/-/hast-util-from-html-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/hast-util-from-html/download/hast-util-from-html-2.0.2.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-html_2.0.2_1724326686664_0.9392572806155779"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-08-22T11:38:06.796Z","publish_time":1724326686796,"_source_registry_name":"default","_cnpm_publish_time":1724326686796},"2.0.1":{"name":"hast-util-from-html","version":"2.0.1","description":"hast utility to parse from HTML","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse","tokenize"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":"./index.js","dependencies":{"@types/hast":"^3.0.0","devlop":"^1.1.0","hast-util-from-parse5":"^8.0.0","parse5":"^7.0.0","vfile":"^6.0.0","vfile-message":"^4.0.0"},"devDependencies":{"@types/mdast":"^4.0.0","@types/node":"^20.0.0","c8":"^8.0.0","mdast-zone":"^6.0.0","prettier":"^3.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","to-vfile":"^8.0.0","type-coverage":"^2.0.0","type-fest":"^4.0.0","typescript":"^5.0.0","unist-builder":"^4.0.0","xo":"^0.55.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["preset-wooorm",["remark-lint-no-html",false],"./script/parse-error.js"]},"typeCoverage":{"atLeast":100,"detail":true,"ignoreCatch":true,"strict":true},"xo":{"overrides":[{"files":"test/**/*.js","rules":{"no-await-in-loop":"off"}}],"prettier":true,"rules":{"unicorn/prefer-code-point":"off","unicorn/prefer-string-replace-all":"off"}},"gitHead":"5e2a0bb04758682af87e82bf62cc95df6624bbf7","types":"./index.d.ts","homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","_id":"hast-util-from-html@2.0.1","_nodeVersion":"20.0.0","_npmVersion":"9.7.2","dist":{"shasum":"9cd38ee81bf40b2607368b92a04b0905fa987488","size":14451,"noattachment":false,"key":"/hast-util-from-html/-/hast-util-from-html-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/hast-util-from-html/download/hast-util-from-html-2.0.1.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-html_2.0.1_1691510171890_0.9229122593550372"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-08T15:56:12.091Z","publish_time":1691510172091,"_source_registry_name":"default","_cnpm_publish_time":1691510172091},"2.0.0":{"name":"hast-util-from-html","version":"2.0.0","description":"hast utility to parse from HTML","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse","tokenize"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","exports":"./index.js","dependencies":{"@types/hast":"^3.0.0","devlop":"^1.1.0","hast-util-from-parse5":"^8.0.0","parse5":"^7.0.0","vfile":"^6.0.0","vfile-message":"^4.0.0"},"devDependencies":{"@types/mdast":"^4.0.0","@types/node":"^20.0.0","c8":"^8.0.0","mdast-zone":"^6.0.0","prettier":"^3.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","to-vfile":"^8.0.0","type-coverage":"^2.0.0","type-fest":"^4.0.0","typescript":"^5.0.0","unist-builder":"^4.0.0","xo":"^0.55.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --log-level warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"bracketSpacing":false,"semi":false,"singleQuote":true,"tabWidth":2,"trailingComma":"none","useTabs":false},"remarkConfig":{"plugins":["preset-wooorm",["remark-lint-no-html",false],"./script/parse-error.js"]},"typeCoverage":{"atLeast":100,"detail":true,"ignoreCatch":true,"strict":true},"xo":{"overrides":[{"files":"test/**/*.js","rules":{"no-await-in-loop":"off"}}],"prettier":true,"rules":{"unicorn/prefer-code-point":"off","unicorn/prefer-string-replace-all":"off"}},"gitHead":"aa490227abfa8df077f13dc034949525398d60dd","types":"./index.d.ts","homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","_id":"hast-util-from-html@2.0.0","_nodeVersion":"20.0.0","_npmVersion":"9.7.2","dist":{"shasum":"a14c6f366a738ea45011bfededad9140ca95985e","size":14391,"noattachment":false,"key":"/hast-util-from-html/-/hast-util-from-html-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hast-util-from-html/download/hast-util-from-html-2.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-html_2.0.0_1691496664658_0.7882383677403144"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-08T12:11:04.802Z","publish_time":1691496664802,"_source_registry_name":"default","_cnpm_publish_time":1691496664802},"1.0.2":{"name":"hast-util-from-html","version":"1.0.2","description":"hast utility to parse from HTML","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse","tokenize"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0","hast-util-from-parse5":"^7.0.0","parse5":"^7.0.0","vfile":"^5.0.0","vfile-message":"^3.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","mdast-zone":"^5.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","type-fest":"^3.0.0","typescript":"^5.0.0","unist-builder":"^3.0.0","xo":"^0.54.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"unicorn/prefer-code-point":"off"},"overrides":[{"files":"test/**/*.js","rules":{"no-await-in-loop":0}}]},"remarkConfig":{"plugins":["preset-wooorm",["remark-lint-no-html",false],"./script/parse-error.js"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"a226fc2808a526dc125dd9c9ee4749c9522fd0c3","homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","_id":"hast-util-from-html@1.0.2","_nodeVersion":"20.0.0","_npmVersion":"9.6.4","dist":{"shasum":"2482fd701b2d8270b912b3909d6fb645d4a346cf","size":14651,"noattachment":false,"key":"/hast-util-from-html/-/hast-util-from-html-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/hast-util-from-html/download/hast-util-from-html-1.0.2.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-html_1.0.2_1683190325529_0.8780503333003591"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-04T08:52:05.722Z","publish_time":1683190325722,"_source_registry_name":"default","_cnpm_publish_time":1683190325722},"1.0.1":{"name":"hast-util-from-html","version":"1.0.1","description":"hast utility to parse from HTML","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse","tokenize"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0","hast-util-from-parse5":"^7.0.0","parse5":"^7.0.0","vfile":"^5.0.0"},"devDependencies":{"@types/node":"^18.0.0","c8":"^7.0.0","mdast-zone":"^5.0.0","prettier":"^2.0.0","remark-cli":"^11.0.0","remark-preset-wooorm":"^9.0.0","type-coverage":"^2.0.0","type-fest":"^3.0.0","typescript":"^4.0.0","unist-builder":"^3.0.0","xo":"^0.53.0"},"scripts":{"prepack":"npm run build && npm run format","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node --conditions development test/index.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"unicorn/prefer-code-point":"off"},"overrides":[{"files":"test/**/*.js","rules":{"no-await-in-loop":0}}]},"remarkConfig":{"plugins":["preset-wooorm",["remark-lint-no-html",false],"./script/parse-error.js"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"fe432de471ea5ed9af163fb805b3ef0be97db5bf","homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","_id":"hast-util-from-html@1.0.1","_nodeVersion":"19.3.0","_npmVersion":"9.2.0","dist":{"shasum":"907a723b3405921efb3339a12bc6481d8ba92925","size":14648,"noattachment":false,"key":"/hast-util-from-html/-/hast-util-from-html-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/hast-util-from-html/download/hast-util-from-html-1.0.1.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-html_1.0.1_1673183906209_0.6575948281029762"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-08T13:18:26.421Z","publish_time":1673183906421,"_cnpm_publish_time":1673183906421},"1.0.0":{"name":"hast-util-from-html","version":"1.0.0","description":"hast utility to parse from HTML","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","parse","tokenize"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-from-html.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0","hast-util-from-parse5":"^7.0.0","parse5":"^7.0.0","vfile":"^5.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","mdast-zone":"^5.0.0","prettier":"^2.0.0","remark-cli":"^10.0.0","remark-preset-wooorm":"^9.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","type-fest":"^2.0.0","typescript":"^4.0.0","unist-builder":"^3.0.0","xo":"^0.49.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"{lib,script,test}/**/*.d.ts\" \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test/index.js","test-coverage":"c8 --check-coverage --100 --reporter lcov npm run test-api","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"unicorn/prefer-code-point":"off"}},"remarkConfig":{"plugins":["preset-wooorm",["remark-lint-no-html",false],"./script/parse-error.js"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"99015a96d42cb4e616733d3bc40da49c463de7ce","homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","_id":"hast-util-from-html@1.0.0","_nodeVersion":"14.18.1","_npmVersion":"8.1.3","dist":{"shasum":"f04fba30c348328ccc1ef2660261e3932441ec3a","size":13723,"noattachment":false,"key":"/hast-util-from-html/-/hast-util-from-html-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hast-util-from-html/download/hast-util-from-html-1.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"kmck","email":"keith@mcknig.ht"},{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-from-html_1.0.0_1653822671942_0.5353887134326598"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-05-29T11:51:18.274Z","publish_time":1653822672110,"_cnpm_publish_time":1653822672110}},"readme":"# hast-util-from-html\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[hast][] utility that turns HTML into a syntax tree.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`fromHtml(value[, options])`](#fromhtmlvalue-options)\n  * [`ErrorCode`](#errorcode)\n  * [`ErrorSeverity`](#errorseverity)\n  * [`OnError`](#onerror)\n  * [`Options`](#options)\n* [Examples](#examples)\n  * [Example: fragment versus document](#example-fragment-versus-document)\n  * [Example: whitespace around and inside `<html>`](#example-whitespace-around-and-inside-html)\n  * [Example: parse errors](#example-parse-errors)\n* [Syntax](#syntax)\n* [Types](#types-2)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a utility that takes HTML input and turns it into a hast syntax\ntree.\n\n## When should I use this?\n\nIf you want to handle syntax trees manually, use this.\n\nUse [`parse5`][parse5] instead when you just want to parse HTML and don’t care\nabout [hast][].\nYou can also use [`hast-util-from-parse5`][hast-util-from-parse5] and\n[`parse5`][parse5] yourself, or use the rehype plugin\n[`rehype-parse`][rehype-parse], which wraps this utility to also parse HTML at\na higher-level (easier) abstraction.\n[`xast-util-from-xml`][xast-util-from-xml] can be used if you are dealing with\nXML instead of HTML.\n\nIf you might run in a browser and prefer a ligher alternative, while not caring\nabout positional info, parse errors, and consistency across browsers, use\n[`hast-util-from-html-isomorphic`][hast-util-from-html-isomorphic], which\nwraps this in Node and uses browser APIs otherwise.\n\nFinally you can use the utility [`hast-util-to-html`][hast-util-to-html] for\nthe inverse of this utility.\nIt turns hast into HTML.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install hast-util-from-html\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {fromHtml} from 'https://esm.sh/hast-util-from-html@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {fromHtml} from 'https://esm.sh/hast-util-from-html@2?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {fromHtml} from 'hast-util-from-html'\n\nconst tree = fromHtml('<h1>Hello, world!</h1>', {fragment: true})\n\nconsole.log(tree)\n```\n\nYields:\n\n```js\n{\n  type: 'root',\n  children: [\n    {\n      type: 'element',\n      tagName: 'h1',\n      properties: {},\n      children: [Array],\n      position: [Object]\n    }\n  ],\n  data: { quirksMode: false },\n  position: {\n    start: { line: 1, column: 1, offset: 0 },\n    end: { line: 1, column: 23, offset: 22 }\n  }\n}\n```\n\n## API\n\nThis package exports the identifier [`fromHtml`][api-from-html].\nThere is no default export.\n\n### `fromHtml(value[, options])`\n\nTurn serialized HTML into a hast tree.\n\n###### Parameters\n\n* `value` ([`Compatible`][compatible])\n  — serialized HTML to parse\n* `options` ([`Options`][api-options], optional)\n  — configuration\n\n###### Returns\n\nTree ([`Root`][root]).\n\n### `ErrorCode`\n\nKnown names of parse errors (TypeScript type).\n\n###### Types\n\n```ts\ntype ErrorCode =\n  | 'abandonedHeadElementChild'\n  | 'abruptClosingOfEmptyComment'\n  | 'abruptDoctypePublicIdentifier'\n  // … see readme on `options[key in ErrorCode]` above.\n```\n\n### `ErrorSeverity`\n\nError severity (TypeScript type).\n\n###### Types\n\n```ts\nexport type ErrorSeverity =\n  // Turn the parse error off:\n  | 0\n  | false\n  // Turn the parse error into a warning:\n  | 1\n  | true\n  // Turn the parse error into an actual error: processing stops.\n  | 2\n```\n\n### `OnError`\n\nFunction called when encountering [HTML parse errors][parse-errors].\n\n###### Parameters\n\n* `error` ([`VFileMessage`][vfile-message])\n  — message\n\n###### Returns\n\nNothing (`void`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n##### Fields\n\n###### `options.space`\n\nWhich space the document is in (`'html'` or `'svg'`, default: `'html'`).\n\nWhen an `<svg>` element is found in the HTML space, `hast-util-from-html`\nalready automatically switches to and from the SVG space when entering and\nexiting it.\n\n> ???? **Note**: this is not an XML parser.\n> It supports SVG as embedded in HTML.\n> It does not support the features available in XML.\n> Passing SVG files might break but fragments of modern SVG should be fine.\n> Use [`xast-util-from-xml`][xast-util-from-xml] to parse XML.\n\n> ???? **Note**: make sure to set `fragment: true` if `space: 'svg'`.\n\n###### `options.verbose`\n\nAdd extra positional info about attributes, start tags, and end tags\n(`boolean`, default: `false`).\n\n###### `options.fragment`\n\nWhether to parse as a fragment (`boolean`, default: `false`).\nThe default is to expect a whole document.\nIn document mode, unopened `html`, `head`, and `body` elements are opened.\n\n###### `options.onerror`\n\nFunction called when encountering [HTML parse errors][parse-errors]\n([`OnError`][api-on-error], optional).\n\n###### `options[key in ErrorCode]`\n\nSpecific parse errors can be configured by setting their identifiers (see\n[`ErrorCode`][api-error-code]) as keys directly in `options` to an\n[`ErrorSeverity`][api-error-severity] as value.\n\nThe list of parse errors:\n\n<!-- parse-error start -->\n\n* `abandonedHeadElementChild` — unexpected metadata element after head ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/abandoned-head-element-child/index.html))\n* [`abruptClosingOfEmptyComment`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-abrupt-closing-of-empty-comment) — unexpected abruptly closed empty comment ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/abrupt-closing-of-empty-comment/index.html))\n* [`abruptDoctypePublicIdentifier`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-abrupt-doctype-public-identifier) — unexpected abruptly closed public identifier ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/abrupt-doctype-public-identifier/index.html))\n* [`abruptDoctypeSystemIdentifier`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-abrupt-doctype-system-identifier) — unexpected abruptly closed system identifier ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/abrupt-doctype-system-identifier/index.html))\n* [`absenceOfDigitsInNumericCharacterReference`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-absence-of-digits-in-numeric-character-reference) — unexpected non-digit at start of numeric character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/absence-of-digits-in-numeric-character-reference/index.html))\n* [`cdataInHtmlContent`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-cdata-in-html-content) — unexpected CDATA section in HTML ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/cdata-in-html-content/index.html))\n* [`characterReferenceOutsideUnicodeRange`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-character-reference-outside-unicode-range) — unexpected too big numeric character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/character-reference-outside-unicode-range/index.html))\n* `closingOfElementWithOpenChildElements` — unexpected closing tag with open child elements ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/closing-of-element-with-open-child-elements/index.html))\n* [`controlCharacterInInputStream`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-control-character-in-input-stream) — unexpected control character ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/control-character-in-input-stream/index.html))\n* [`controlCharacterReference`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-control-character-reference) — unexpected control character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/control-character-reference/index.html))\n* `disallowedContentInNoscriptInHead` — disallowed content inside `<noscript>` in `<head>` ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/disallowed-content-in-noscript-in-head/index.html))\n* [`duplicateAttribute`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-duplicate-attribute) — unexpected duplicate attribute ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/duplicate-attribute/index.html))\n* [`endTagWithAttributes`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-end-tag-with-attributes) — unexpected attribute on closing tag ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/end-tag-with-attributes/index.html))\n* [`endTagWithTrailingSolidus`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-end-tag-with-trailing-solidus) — unexpected slash at end of closing tag ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/end-tag-with-trailing-solidus/index.html))\n* `endTagWithoutMatchingOpenElement` — unexpected unopened end tag ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/end-tag-without-matching-open-element/index.html))\n* [`eofBeforeTagName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-eof-before-tag-name) — unexpected end of file ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/eof-before-tag-name/index.html))\n* [`eofInCdata`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-eof-in-cdata) — unexpected end of file in CDATA ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/eof-in-cdata/index.html))\n* [`eofInComment`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-eof-in-comment) — unexpected end of file in comment ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/eof-in-comment/index.html))\n* [`eofInDoctype`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-eof-in-doctype) — unexpected end of file in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/eof-in-doctype/index.html))\n* `eofInElementThatCanContainOnlyText` — unexpected end of file in element that can only contain text ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/eof-in-element-that-can-contain-only-text/index.html))\n* [`eofInScriptHtmlCommentLikeText`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-eof-in-script-html-comment-like-text) — unexpected end of file in comment inside script ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/eof-in-script-html-comment-like-text/index.html))\n* [`eofInTag`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-eof-in-tag) — unexpected end of file in tag ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/eof-in-tag/index.html))\n* [`incorrectlyClosedComment`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment) — incorrectly closed comment ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/incorrectly-closed-comment/index.html))\n* [`incorrectlyOpenedComment`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-opened-comment) — incorrectly opened comment ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/incorrectly-opened-comment/index.html))\n* [`invalidCharacterSequenceAfterDoctypeName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-invalid-character-sequence-after-doctype-name) — invalid sequence after doctype name ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/invalid-character-sequence-after-doctype-name/index.html))\n* [`invalidFirstCharacterOfTagName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-invalid-first-character-of-tag-name) — invalid first character in tag name ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/invalid-first-character-of-tag-name/index.html))\n* `misplacedDoctype` — misplaced doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/misplaced-doctype/index.html))\n* `misplacedStartTagForHeadElement` — misplaced `<head>` start tag ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/misplaced-start-tag-for-head-element/index.html))\n* [`missingAttributeValue`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-attribute-value) — missing attribute value ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-attribute-value/index.html))\n* `missingDoctype` — missing doctype before other content ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-doctype/index.html))\n* [`missingDoctypeName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-doctype-name) — missing doctype name ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-doctype-name/index.html))\n* [`missingDoctypePublicIdentifier`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-doctype-public-identifier) — missing public identifier in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-doctype-public-identifier/index.html))\n* [`missingDoctypeSystemIdentifier`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-doctype-system-identifier) — missing system identifier in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-doctype-system-identifier/index.html))\n* [`missingEndTagName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-end-tag-name) — missing name in end tag ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-end-tag-name/index.html))\n* [`missingQuoteBeforeDoctypePublicIdentifier`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-quote-before-doctype-public-identifier) — missing quote before public identifier in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-quote-before-doctype-public-identifier/index.html))\n* [`missingQuoteBeforeDoctypeSystemIdentifier`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-quote-before-doctype-system-identifier) — missing quote before system identifier in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-quote-before-doctype-system-identifier/index.html))\n* [`missingSemicolonAfterCharacterReference`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-semicolon-after-character-reference) — missing semicolon after character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-semicolon-after-character-reference/index.html))\n* [`missingWhitespaceAfterDoctypePublicKeyword`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-whitespace-after-doctype-public-keyword) — missing whitespace after public identifier in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-whitespace-after-doctype-public-keyword/index.html))\n* [`missingWhitespaceAfterDoctypeSystemKeyword`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-whitespace-after-doctype-system-keyword) — missing whitespace after system identifier in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-whitespace-after-doctype-system-keyword/index.html))\n* [`missingWhitespaceBeforeDoctypeName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-whitespace-before-doctype-name) — missing whitespace before doctype name ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-whitespace-before-doctype-name/index.html))\n* [`missingWhitespaceBetweenAttributes`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-whitespace-between-attributes) — missing whitespace between attributes ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-whitespace-between-attributes/index.html))\n* [`missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-whitespace-between-doctype-public-and-system-identifiers) — missing whitespace between public and system identifiers in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/missing-whitespace-between-doctype-public-and-system-identifiers/index.html))\n* [`nestedComment`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-nested-comment) — unexpected nested comment ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/nested-comment/index.html))\n* `nestedNoscriptInHead` — unexpected nested `<noscript>` in `<head>` ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/nested-noscript-in-head/index.html))\n* `nonConformingDoctype` — unexpected non-conforming doctype declaration ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/non-conforming-doctype/index.html))\n* [`nonVoidHtmlElementStartTagWithTrailingSolidus`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-non-void-html-element-start-tag-with-trailing-solidus) — unexpected trailing slash on start tag of non-void element ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/non-void-html-element-start-tag-with-trailing-solidus/index.html))\n* [`noncharacterCharacterReference`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-noncharacter-character-reference) — unexpected noncharacter code point referenced by character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/noncharacter-character-reference/index.html))\n* [`noncharacterInInputStream`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-noncharacter-in-input-stream) — unexpected noncharacter character ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/noncharacter-in-input-stream/index.html))\n* [`nullCharacterReference`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-null-character-reference) — unexpected NULL character referenced by character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/null-character-reference/index.html))\n* `openElementsLeftAfterEof` — unexpected end of file ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/open-elements-left-after-eof/index.html))\n* [`surrogateCharacterReference`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-surrogate-character-reference) — unexpected surrogate character referenced by character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/surrogate-character-reference/index.html))\n* [`surrogateInInputStream`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-surrogate-in-input-stream) — unexpected surrogate character\n* [`unexpectedCharacterAfterDoctypeSystemIdentifier`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unexpected-character-after-doctype-system-identifier) — invalid character after system identifier in doctype ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unexpected-character-after-doctype-system-identifier/index.html))\n* [`unexpectedCharacterInAttributeName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unexpected-character-in-attribute-name) — unexpected character in attribute name ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unexpected-character-in-attribute-name/index.html))\n* [`unexpectedCharacterInUnquotedAttributeValue`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unexpected-character-in-unquoted-attribute-value) — unexpected character in unquoted attribute value ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unexpected-character-in-unquoted-attribute-value/index.html))\n* [`unexpectedEqualsSignBeforeAttributeName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unexpected-equals-sign-before-attribute-name) — unexpected equals sign before attribute name ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unexpected-equals-sign-before-attribute-name/index.html))\n* [`unexpectedNullCharacter`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unexpected-null-character) — unexpected NULL character ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unexpected-null-character/index.html))\n* [`unexpectedQuestionMarkInsteadOfTagName`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unexpected-question-mark-instead-of-tag-name) — unexpected question mark instead of tag name ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unexpected-question-mark-instead-of-tag-name/index.html))\n* [`unexpectedSolidusInTag`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unexpected-solidus-in-tag) — unexpected slash in tag ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unexpected-solidus-in-tag/index.html))\n* [`unknownNamedCharacterReference`](https://html.spec.whatwg.org/multipage/parsing.html#parse-error-unknown-named-character-reference) — unexpected unknown named character reference ([example](https://github.com/syntax-tree/hast-util-from-html/blob/main/test/parse-error/unknown-named-character-reference/index.html))\n\n<!-- parse-error end -->\n\n## Examples\n\n### Example: fragment versus document\n\nThe following example shows the difference between parsing as a document and\nparsing as a fragment:\n\n```js\nimport {fromHtml} from 'hast-util-from-html'\n\nconst doc = '<title>Hi!</title><h1>Hello!</h1>'\n\nconsole.log(fromHtml(doc))\n\nconsole.log(fromHtml(doc, {fragment: true}))\n```\n\n…yields (positional info and data omitted for brevity):\n\n```js\n{\n  type: 'root',\n  children: [\n    {type: 'element', tagName: 'html', properties: {}, children: [Array]}\n  ]\n}\n```\n\n```js\n{\n  type: 'root',\n  children: [\n    {type: 'element', tagName: 'title', properties: {}, children: [Array]},\n    {type: 'element', tagName: 'h1', properties: {}, children: [Array]}\n  ]\n}\n```\n\n> ???? **Note**: observe that when a whole document is expected (first example),\n> missing elements are opened and closed.\n\n### Example: whitespace around and inside `<html>`\n\nThe following example shows how whitespace is handled when around and directly\ninside the `<html>` element:\n\n```js\nimport {fromHtml} from 'hast-util-from-html'\nimport {inspect} from 'unist-util-inspect'\n\nconst doc = `<!doctype html>\n<html lang=en>\n  <head>\n    <title>Hi!</title>\n  </head>\n  <body>\n    <h1>Hello!</h1>\n  </body>\n</html>`\n\nconsole.log(inspect(fromHtml(doc)))\n```\n\n…yields:\n\n```txt\nroot[2] (1:1-9:8, 0-119)\n│ data: {\"quirksMode\":false}\n├─0 doctype (1:1-1:16, 0-15)\n└─1 element<html>[3] (2:1-9:8, 16-119)\n    │ properties: {\"lang\":\"en\"}\n    ├─0 element<head>[3] (3:3-5:10, 33-72)\n    │   │ properties: {}\n    │   ├─0 text \"\\n    \" (3:9-4:5, 39-44)\n    │   ├─1 element<title>[1] (4:5-4:23, 44-62)\n    │   │   │ properties: {}\n    │   │   └─0 text \"Hi!\" (4:12-4:15, 51-54)\n    │   └─2 text \"\\n  \" (4:23-5:3, 62-65)\n    ├─1 text \"\\n  \" (5:10-6:3, 72-75)\n    └─2 element<body>[3] (6:3-8:10, 75-111)\n        │ properties: {}\n        ├─0 text \"\\n    \" (6:9-7:5, 81-86)\n        ├─1 element<h1>[1] (7:5-7:20, 86-101)\n        │   │ properties: {}\n        │   └─0 text \"Hello!\" (7:9-7:15, 90-96)\n        └─2 text \"\\n  \\n\" (7:20-9:1, 101-112)\n```\n\n> ???? **Note**: observe that the line ending before `<html>` is ignored, the line\n> ending and two spaces before `<head>` is moved inside it, and the line ending\n> after `</body>` is moved before it.\n\nThis behavior is described by the HTML standard (see the section 13.2.6.4.1\n“The ‘initial’ insertion mode” and adjacent states) which we follow.\n\nThe changes to this meaningless whitespace should not matter, except when\nformatting markup, in which case [`rehype-format`][rehype-format] can be used to\nimprove the source code.\n\n### Example: parse errors\n\nThe following example shows how HTML parse errors can be enabled and configured:\n\n```js\nimport {fromHtml} from 'hast-util-from-html'\n\nconst doc = `<!doctypehtml>\n<title class=\"a\" class=\"b\">Hello…</title>\n<h1/>World!</h1>`\n\nfromHtml(doc, {\n  onerror: console.log,\n  missingWhitespaceBeforeDoctypeName: 2, // Mark one as a fatal error.\n  nonVoidHtmlElementStartTagWithTrailingSolidus: false // Ignore one.\n})\n```\n\n…yields:\n\n```txt\n[1:10-1:10: Missing whitespace before doctype name] {\n  ancestors: undefined,\n  cause: undefined,\n  column: 10,\n  fatal: true,\n  line: 1,\n  place: {\n    start: { line: 1, column: 10, offset: 9 },\n    end: { line: 1, column: 10, offset: 9 }\n  },\n  reason: 'Missing whitespace before doctype name',\n  ruleId: 'missing-whitespace-before-doctype-name',\n  source: 'hast-util-from-html',\n  note: 'Unexpected `h`. Expected ASCII whitespace instead',\n  url: 'https://html.spec.whatwg.org/multipage/parsing.html#parse-error-missing-whitespace-before-doctype-name'\n}\n[2:23-2:23: Unexpected duplicate attribute] {\n  ancestors: undefined,\n  cause: undefined,\n  column: 23,\n  fatal: false,\n  line: 2,\n  place: {\n    start: { line: 2, column: 23, offset: 37 },\n    end: { line: 2, column: 23, offset: 37 }\n  },\n  reason: 'Unexpected duplicate attribute',\n  ruleId: 'duplicate-attribute',\n  source: 'hast-util-from-html',\n  note: 'Unexpectedly double attribute. Expected attributes to occur only once',\n  url: 'https://html.spec.whatwg.org/multipage/parsing.html#parse-error-duplicate-attribute'\n}\n```\n\n> ????‍???? **Info**: messages in unified are warnings instead of errors.\n> Other linters (such as ESLint) almost always use errors.\n> Why?\n> Those tools *only* check code style.\n> They don’t generate, transform, and format code, which is what we focus on,\n> too.\n> Errors in unified mean the same as an exception in your JavaScript code: a\n> crash.\n> That’s why we use warnings instead, because we can continue doing work.\n\n## Syntax\n\nHTML is parsed according to WHATWG HTML (the living standard), which is also\nfollowed by browsers such as Chrome and Firefox.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types\n[`ErrorCode`][api-error-code], [`ErrorSeverity`][api-error-severity],\n[`OnError`][api-on-error], and [`Options`][api-options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `hast-util-from-html@^2`,\ncompatible with Node.js 16.\n\n## Security\n\nParsing HTML is safe but using user-provided content can open you up to a\n[cross-site scripting (XSS)][xss] attack.\nUse [`hast-util-santize`][hast-util-sanitize] to make the hast tree safe.\n\n## Related\n\n* [`hast-util-to-html`](https://github.com/syntax-tree/hast-util-to-html)\n  — serialize hast\n* [`hast-util-sanitize`](https://github.com/syntax-tree/hast-util-sanitize)\n  — sanitize hast\n* [`xast-util-from-xml`][xast-util-from-xml]\n  — parse XML\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/syntax-tree/hast-util-from-html/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/hast-util-from-html/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-from-html.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/hast-util-from-html\n\n[downloads-badge]: https://img.shields.io/npm/dm/hast-util-from-html.svg\n\n[downloads]: https://www.npmjs.com/package/hast-util-from-html\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-from-html\n\n[size]: https://bundlejs.com/?q=hast-util-from-html\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[hast]: https://github.com/syntax-tree/hast\n\n[root]: https://github.com/syntax-tree/hast#root\n\n[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize\n\n[hast-util-from-parse5]: https://github.com/syntax-tree/hast-util-from-parse5\n\n[hast-util-to-html]: https://github.com/syntax-tree/hast-util-to-html\n\n[xast-util-from-xml]: https://github.com/syntax-tree/xast-util-from-xml\n\n[rehype-parse]: https://github.com/rehypejs/rehype/tree/main/packages/rehype-parse#readme\n\n[rehype-format]: https://github.com/rehypejs/rehype-format\n\n[parse5]: https://github.com/inikulin/parse5\n\n[parse-errors]: https://html.spec.whatwg.org/multipage/parsing.html#parse-errors\n\n[vfile-message]: https://github.com/vfile/vfile-message#vfilemessagereason-place-origin\n\n[hast-util-from-html-isomorphic]: https://github.com/syntax-tree/hast-util-from-html-isomorphic\n\n[compatible]: https://github.com/vfile/vfile#compatible\n\n[api-from-html]: #fromhtmlvalue-options\n\n[api-error-code]: #errorcode\n\n[api-error-severity]: #errorseverity\n\n[api-on-error]: #onerror\n\n[api-options]: #options\n","_attachments":{},"homepage":"https://github.com/syntax-tree/hast-util-from-html#readme","bugs":{"url":"https://github.com/syntax-tree/hast-util-from-html/issues"},"license":"MIT"}