0.1.1 • Published 1 year ago

@z1c1/remark-directive-custom-dataset-tag-plugin v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@z1c1/remark-directive-custom-dataset-tag-plugin

npm package npm download github language top github stars

NPM

A remark plugin which helps create a custom html tag with specified dataset. This works together with remark-directive.

Usage

npm install --save @z1c1/remark-directive-custom-dataset-tag-plugin
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkDirective from 'remark-directive';
import remarkGfm from 'remark-gfm';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
import remarkDirectiveCustomDatasetTagPlugin from '@z1c1/remark-directive-custom-dataset-tag-plugin';

// markdown text to html parser
const parseMarkdown = raw =>
  unified()
  .use(remarkParse)
  .use(remarkDirective)
  .use(remarkDirectiveCustomDatasetTagPlugin, { name: 'CUSTOM_NAME', class: 'custom-tag' })
  .use(remarkGfm)
  .use(remarkRehype, { allowDangerousHtml: true })
  .use(rehypeStringify, { allowDangerousHtml: true })
  .processSync(raw)
  .toString();

Start

# eg. preparations
npm install

# eg. build the project
npm run build

# eg. test
npm test

# eg. release
npm run release

Contributing

How to contribute to this?

Recently changes

See the change log.

License

MIT