Gathering detailed insights and metrics for @nfrasser/simple-html-tokenizer
Gathering detailed insights and metrics for @nfrasser/simple-html-tokenizer
Gathering detailed insights and metrics for @nfrasser/simple-html-tokenizer
Gathering detailed insights and metrics for @nfrasser/simple-html-tokenizer
A lightweight JavaScript library for tokenizing non-`<script>` HTML expected to be found in the `<body>` of a document
npm install @nfrasser/simple-html-tokenizer
Typescript
Module System
Node Version
NPM Version
TypeScript (86.67%)
JavaScript (12.74%)
HTML (0.58%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
3 Stars
205 Commits
2 Forks
1 Watchers
5 Branches
1 Contributors
Updated on May 08, 2025
Minified
Minified + Gzipped
Latest Version
0.5.11-3
Package Id
@nfrasser/simple-html-tokenizer@0.5.11-3
Unpacked Size
190.98 kB
Size
26.07 kB
File Count
16
NPM Version
10.9.0
Node Version
22.11.0
Published on
May 07, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Simple HTML Tokenizer is a lightweight JavaScript library that can be used to tokenize the kind of HTML normally found in templates. It can be used to preprocess templates to change the behavior of some template element depending upon whether the template element was found in an attribute or text.
It is not a full HTML5 tokenizer. It focuses on the kind of HTML that is
used in templates: content designed to be inserted into the <body>
and without <script>
tags.
In particular, Simple HTML Tokenizer does not handle many states from the HTML5 Tokenizer Specification:
CDATA
or RCDATA
<script>
<DOCTYPE>
It also passes through character references, instead of trying to tokenize and process them, because the preprocessed templates will ultimately be parsed by a real browser context.
At the moment, there are some error states specified by the tokenizer spec that are not handled by Simple HTML Tokenizer. Ultimately, I plan to support all error states, as well as provide information about tokenizer errors in debug mode.
You can tokenize HTML:
1var tokens = HTML5Tokenizer.tokenize("<div id='foo' href=bar class=\"bat\">"); 2 3var token = tokens[0]; 4token.tagName //=> "div" 5token.attributes //=> [["id", "foo"], ["href", "bar"], ["class", "bat"]] 6token.selfClosing //=> false
1npm install 2npm test
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
30 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More