0.0.20 • Published 3 years ago

rehype-indexes v0.0.20

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

rehype-indexes

header index library for rehype

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install rehype-indexes

this library is intended to support react-markdown interactively. as named indexes, It supports heading tag to have suffix index number with anchor tag.

Use

following source code shows how to use with react-markdown.

import rehypIndex from 'rehype-indexes';

///... for index
<ReactMarkDown rehypePlugins={[[rehypeIndex, {mode: 'index'} ]]}>
{text}
</ReactMarkDown>

///... for origin document
<ReactMarkDown rehypePlugins={[[rehypeIndex, {mode: 'document'}]]}>
{text}
</ReactMarkDown>

Options

{mode: 'index'} or non-option.

  • works for index.
  • It remove all non-heading tags exclude tags inside heading tag. (! you don't need to remove non-heading tag by yourself.)
  • It appends anchor tag 1 based.
  • anchor tag has link to document heading id.

{mode: 'document'}

  • works for document.
  • It add id tag to heading.

Related

Contribute

All contributes are wellcome! 😀

License

MIT © Jeong Yo Han

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago