Socket
Socket
Sign inDemoInstall

react-toc-hash-link

Package Overview
Dependencies
6
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-toc-hash-link

Create a table of contents for react hash link from the given markdown text.


Version published
Weekly downloads
9
increased by80%
Maintainers
1
Install size
18.7 MB
Created
Weekly downloads
 

Readme

Source

: 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

FAQs

Last updated on 12 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc