react-toc-hash-link
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

react-toc-hash-link

: THIS NPM IS BASED ON react-toc

: JUST ADDED url parameter and react-router-hash-link ON HERE

Installation

npm install --save react-toc-hash-link
import React from "react";
import Toc from "react-toc-hash-link";

const Example = () => {
  const yourMarkdownText = "# test \n your markdown Content # test2\n";
  return <Toc markdownText={yourMarkdownText} className={"customClassName"} url={url}/>;
};

export default Example;

: Toc will return a tag as HashLink in react-router-hash-link

: It will make you can use Anchor Link on React Project

Example

const markdownText = '### 3. This is Example';
...
	return <Toc markdownText={markdownText}  url={'/post'}/>;   
    // result : <ul><ul><ul><li><a href="#/post#3.-This-is-Example">3. This is Example</a></li></ul></ul></ul>

:blank will be replace to '-' on href Anchor url (url in url parament has no difference)

: result a tag is adjusted as HashLink in react-router-hash-link

Readme

Keywords

none

Package Sidebar

Install

npm i react-toc-hash-link

Weekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

37.6 kB

Total Files

12

Last publish

Collaborators

  • hanswind