npm.io
2.1.0 • Published 1 month ago

markdown-magic-pulpo-schema

Licence
MIT
Version
2.1.0
Deps
0
Size
6 kB
Vulns
0
Weekly
0

Schema plugin

Add install command to markdown files via markdown-magic

Install

npm i markdown-magic markdown-magic-install-command --save-dev

Adding the plugin

See example.ts for usage.

import path from 'path';
import Pulpo from 'pulpo';
import { markdownMagic } from 'markdown-magic';
import SCHEMA from './index.ts';

const config = {
  matchWord: 'AUTO-GENERATED-CONTENT',
  transforms: {
    SCHEMA: SCHEMA(
      new Pulpo({
        host: {
          description: 'Host for the server',
          type: 'string',
          default: 'localhost',
          argv: 'host',
        },
        port: {
          description: 'Port for dev server to run on',
          type: 'number',
          default: '3000',
          env: 'PORT',
        },
      }),
    ),
  },
};

const markdownPath = path.join(import.meta.dirname, 'README.md');
await markdownMagic(markdownPath, config);

Usage in markdown

  • host (string) - Host for the server
    • default - localhost
    • argv - host
  • port (number) - Port for dev server to run on
    • default - 3000
    • env - PORT

Keywords