Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sika7/silver-html

sika716MIT1.0.1TypeScript support: included

this package is provides HTML recursive processing.

html, parser, recursive processing

readme

License: MIT

@sika7/silver-html

this package is Can be recursively deleted or modified. for CommentNode and TextNode and ElementNode.

Usage

Step 1: Install plugin:

npm install --save @sika7/silver-html

Step 2: add a functions or plugin.

use example more

import { silverHtml } from '@sika7/silver-html'

const plugin = {
  pluginName: "devToMain",
  ElementNode: [
    {
      name: "all change tag for main",
      function: (element) => {
        element.tagName = "main";
        return element;
      },
    },
  ],
}
const result = silverHtml("<div>test</div>", {}, [plugin]);
console.log(result)
# <main>test</main>

plugin

plugin config.

const plugin = {
  pluginName: 'pluginName'; // required.
  ElementNode?: (node, level)    => node | null;
  CommentNode?: (comment, level) => node | null;
  TextNode?: (text, level)       => node | null;
}
setting description
pluginName plugin name.
ElementNode When creating recursive processing of elements
CommentNode When creating recursive processing of comment
TextNode When creating recursive processing of text

changelog

Change Log

[Unreleased]

1.0.1 - 2021-12-08

Fixed

  • Fix Multiple processing null error.

1.0.0 - 2021-12-08

Changed

  • The official version has been released
  • Remove Processing for tag
  • Remove Processing for ChildNode
  • Remove Processing for attribute
  • Remove Processing for attributes

0.0.0 - 2021-12-01

Added

  • Addition of basic functions
    • Recursive processing for html

This project adheres to Semantic Versioning.