1.0.0 • Published 10 months ago

rehype-input-disable v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

rehype-input-disable

A rehype plugin to disable or enable specific input elements.

Install

npm install rehype-input-disable

Options

Optional:

  • type: filer by input type, e.g. "checkbox"
  • disabled: set the property to either true or false. Defaults to true.

Usage

import { rehype } from "rehype";
import rehypeInputDisable from "rehypeInputDisable";

rehype()
  .use(rehypeInputDisable, { type: "checkbox" disabled: False })
  .process('<input type="checkbox" id="key" value="1" disabled>', function (err, file) {
    if (err) throw err;
    console.log(String(file));
  });

Expected output:

<html>
  <head></head>
  <body>
    <input type="checkbox" id="key" value="1" />
  </body>
</html>