JSPM

esdoc-plugin-transform-html

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q13158F
  • License ISC

ESDoc plugin to transform generated HTML

Package Exports

  • esdoc-plugin-transform-html

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (esdoc-plugin-transform-html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

esdoc-plugin-transform-html

ESDoc plugin to transform generated HTML

Installation

npm install --save-dev esdoc-plugin-transform-html

Usage

Add the esdoc-plugin-transform-html to your ESDoc config...

{
  ...
  "plugins": [
    {
      "name": "esdoc-plugin-transform-html",
      "option": ...
    }
  ]
}

Options

The option property can either be an Object...

{
  ...
  "plugins": [
    {
      "name": "esdoc-plugin-transform-html",
      "option": {
        ...
      }
    }
  ]
}

or an Array<Object>...

{
  ...
  "plugins": [
    {
      "name": "esdoc-plugin-transform-html",
      "option": [
        { ... },
        { ... }
      ]
    }
  ]
}

If you provide an Array, each option object within that array will be applied sequentially.

Available Options

Option Behavior Default
includes An Array<String> or String of glob patterns to include **/*
excludes An Array<String> or String of glob patterns to exclude
scope The HTML tag scope (e.g. title to match the <title>...</title>)
prefix A String to append before the content
suffix A String to append after the content
replace An Object of options to replace content
replace.match A String to match against. By default this will be converted to a RegExp
replace.with A String to replace the matched pattern. Note that you can reference captured groups using $ (e.g. $1)
replace.regex If false, replace.match will not be converted to a RegExp and instead will use a raw String. If a String, will be passed to new RegExp() as the flags. gi (flags)

Example

{
  ...
  "plugins": [
    {
      "name": "esdoc-plugin-transform-html",
      "option": [
        // append your config.title to the end of your <title> tag
        {
          "scope": "title", // scope to the <title> tag
          "includes": ["manual/**/*", "index.html"], // apply to all pages under manual/**/* and index.html
          "suffix": " | ${config.title}" // you can reference config properties via `${config.<property>}`
        },
        // strip off the `API Document` added by ESDoc
        {
          "scope": "title",
          "replace": {
            "match": "(.*) API Document",
            "with": "$1"
          }
        },
      ]
    }
  ]
}