{"library":"rehype-minify-javascript-url","title":"Rehype Minify JavaScript URL","description":"rehype-minify-javascript-url is a rehype plugin designed to optimize HTML documents by minifying `javascript:` URL attributes found within various HTML tags. It's an integral part of the unified collective's rehype ecosystem, which focuses on transforming HTML with a plugin-based architecture. The current stable version is 5.0.1. This package specifically targets and reduces the size of JavaScript code embedded within URL attributes by applying minification techniques (e.g., transforming `alert(true)` to `alert(!0)`). Following the unified ecosystem's release cadence, it ensures compatibility with maintained Node.js versions, currently requiring Node.js 16 or newer. Its primary differentiator is its specialized focus on JavaScript URL minification, contributing to overall HTML document size reduction within the robust rehype processing pipeline.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install rehype-minify-javascript-url"],"cli":null},"imports":["import rehypeMinifyJavaScriptUrl from 'rehype-minify-javascript-url'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import rehypeMinifyJavaScriptUrl from 'rehype-minify-javascript-url'\nimport rehypeParse from 'rehype-parse'\nimport rehypeStringify from 'rehype-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\n\nasync function processHtml() {\n  const file = await unified()\n    .use(rehypeParse)\n    .use(rehypeMinifyJavaScriptUrl)\n    .use(rehypeStringify)\n    .process(await read('index.html'))\n\n  console.log(String(file))\n}\n\n// Assuming 'index.html' exists in the current directory with content like:\n// <a href=\"javascript:alert(true)\">Click me</a>\n// For a runnable example, you might create a dummy file:\n// import { write } from 'to-vfile';\n// await write({ path: 'index.html', value: '<a href=\"javascript:alert(true)\">Click me</a>' });\n\nprocessHtml().catch(console.error);","lang":"typescript","description":"Demonstrates how to use rehype-minify-javascript-url within a unified pipeline to parse HTML, minify JavaScript URLs, and then stringify the result.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}