This commit is contained in:
Jordan Eldredge 2026-01-21 20:20:44 +00:00 committed by GitHub
commit e15b20e004
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 2138 additions and 0 deletions

View file

@ -0,0 +1 @@
out.html

View file

@ -0,0 +1,6 @@
# Install and Run
```bash
yarn install
node index.js
```

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,21 @@
import fs from "fs";
import Hat from "html-ast-transform";
const { transform, h, getAttr, hasClass } = Hat;
const replaceTags = {
code: (node) => {
return h("h1", [], [h("#text", "Hello")]);
},
};
function clean(html) {
return transform(html, { replaceTags });
}
function main(fileName, output) {
const html = fs.readFileSync(fileName, { encoding: "utf8" });
fs.writeFileSync(output, clean(html));
}
main("./example.html", "out.html");

View file

@ -0,0 +1,11 @@
{
"name": "winamp-forum-normalizer",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"type": "module",
"dependencies": {
"html-ast-transform": "^2.0.1",
"parse5": "^6.0.1"
}
}

View file

@ -0,0 +1,13 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
html-ast-transform@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/html-ast-transform/-/html-ast-transform-2.0.1.tgz#404f7cac93f8aecd425ee3e381718e5e253eaded"
integrity sha512-ryBf1oxFM1s12/lD2qChqrdsG0Y2ajdCZJnNPjY2oeS+UDF3wwYP7ubP0wxM6h72dKxdgtmihAc55x3gtDqM4Q==
parse5@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b"
integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==