JSPM

cem-plugin-type-descriptions-markdown

0.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48
  • Score
    100M100P100Q53847F
  • License MIT

Append markdown descriptions to types

Package Exports

  • cem-plugin-type-descriptions-markdown
  • cem-plugin-type-descriptions-markdown/index.js

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 (cem-plugin-type-descriptions-markdown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cem-plugin-type-descriptions-markdown

Appends Markdown documents to function parameter and return types and class field types.

Options

Option Type Required Description
typeTablesDir string yes Absolute path to the directory holding the type docs.
quiet bool no Suppress logs

Example

custom-elements-manifest.config.js

import { fileURLToPath } from 'url';
import { typeDescriptionsMarkdownPlugin } from 'cem-plugin-type-descriptions-markdown';

export default {
  plugins: [
    typeDescriptionsMarkdownPlugin({
      typeTablesDir: fileURLToPath(new URL('../../docs/type-tables/', import.meta.url)),
    }),
  ]
}

docs/type-tables/BigBagOfProperties.md

| Option     | Type   | Description |
| ---------- | ------ | ----------- |
| name       | string | The name of the thing |
| shoeSize   | number | Act your age |

src/shoe-sizer.ts

interface BigBagOfProperties {
  name?: string;
  shoeSize?: number;
}

/** @element shoe-sizer */
export class ShoeSizer {
  /** @summary Shoe Size options */
  declare options: BigBagOfProperties;
}

Output

{
  "schemaVersion": "1.0.0",
  "readme": "",
  "modules": [
    {
      "kind": "javascript-module",
      "path": "src/shoe-sizer.js",
      "declarations": [
        {
          "kind": "class",
          "name": "ShoeSizer",
          "description": "",
          "members": [
            {
              "kind": "field",
              "name": "options",
              "summary": "Shoe Size options",
              "description": "| Option     | Type   | Description |\n| ---------- | ------ | ----------- |\n| name       | string | The name of the thing |\n| shoeSize   | number | Act your age |",
              "type": {
                "text": "BigBagOfProperties"
              }
            }
          ],
          "tagName": "shoe-sizer",
          "customElement": true
        }
      ],
      "exports": [
        {
          "kind": "js",
          "name": "ShoeSizer",
          "declaration": {
            "name": "ShoeSizer",
            "module": "src/shoe-sizer.js"
          }
        }
      ]
    }
  ]
}