All Projects → parksben → markdown-navbar

parksben / markdown-navbar

Licence: MIT license
Best markdown navigation bar for React.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to markdown-navbar

react-async-button
React button component for handling async actions
Stars: ✭ 31 (-74.59%)
Mutual labels:  react-component
create-chakra-icons
Transform SVGs to React Chakra UI <Icon /> ✨
Stars: ✭ 80 (-34.43%)
Mutual labels:  react-component
react-example-paginated-list-infinite-scroll
Follow a React tutorial series with three parts to build a powerful component in React.
Stars: ✭ 43 (-64.75%)
Mutual labels:  react-component
react-accessible-modal
Accessible modal dialog component for React
Stars: ✭ 17 (-86.07%)
Mutual labels:  react-component
react-sweet-progress
A way to quickly add a progress bar to react app 🌈
Stars: ✭ 250 (+104.92%)
Mutual labels:  react-component
react-simple-range
🔉 React slider component for inputting a numeric value within a range.
Stars: ✭ 20 (-83.61%)
Mutual labels:  react-component
animation-wrapper-view
Declarative animations with imperative controls for RN/RNW.
Stars: ✭ 53 (-56.56%)
Mutual labels:  react-component
react-instagram-authless-feed
React component to provide a token-less Instagram feed.
Stars: ✭ 50 (-59.02%)
Mutual labels:  react-component
react-jsonschema-form-layout
Simple Layout Field to offer a variety possibilities to react-jsonschema-forms
Stars: ✭ 67 (-45.08%)
Mutual labels:  react-component
react-windows-ui
Build Windows fluent UI apps using ReactJS. Provides a set of accessible, reusable, and composable React components that make it super easy to create websites and apps.
Stars: ✭ 383 (+213.93%)
Mutual labels:  react-component
react-native-stateview
A react native wrapper view to add loading, content, error and placeholder states to your component
Stars: ✭ 28 (-77.05%)
Mutual labels:  react-component
react-circle-flags
🚀 A React component with a collection of 300+ minimal circular SVG country flags. Wrapper of HatScripts/circle-flags
Stars: ✭ 29 (-76.23%)
Mutual labels:  react-component
win95-media-player
💿 Back from 1995, and running on your website
Stars: ✭ 56 (-54.1%)
Mutual labels:  react-component
react-markdown-heading
Render markdown table of contents as React component.
Stars: ✭ 18 (-85.25%)
Mutual labels:  react-component
react-carousel-minimal
React.js Responsive Minimal Carousel
Stars: ✭ 76 (-37.7%)
Mutual labels:  react-component
React-Limited-Infinite-Scroll
A limited infinite scroll component for React(React有限无限加载组件)
Stars: ✭ 37 (-69.67%)
Mutual labels:  react-component
react-fusionui
☢️ Nuclear power-up for your UI.
Stars: ✭ 13 (-89.34%)
Mutual labels:  react-component
react-fake-component
Chuck Norris faking components
Stars: ✭ 24 (-80.33%)
Mutual labels:  react-component
react-touch-ripple
Create ripple effect from Material Design with React
Stars: ✭ 27 (-77.87%)
Mutual labels:  react-component
react-compare-slider
A slider component to compare any two React components in landscape or portrait orientation. It supports custom images, videos... and everything else.
Stars: ✭ 78 (-36.07%)
Mutual labels:  react-component

Markdown-Navbar

npm npm npm GitHub file size in bytes

A React component renders an interactive navbar panel of Markdown docs for your blog or website.

Demo on Netlify

Features

Implement some regular functions easily by using this component, such as:

  • Display the structure tree of your article defined by the headings.
  • Render anchors that navigate to specific headings in the article.
  • Share one URL to readers to navigate to a specific area of the article.

Install

yarn add markdown-navbar # or `npm i markdown-navbar --save`

Quickstart

Edit markdown-navbar-demo-online

import React from 'react';
import ReactDOM from 'react-dom';
// One third-part component for render markdown documentation
import ReactMarkdown from 'react-markdown';
import MarkdownNavbar from 'markdown-navbar';
// The default style of markdown-navbar should be imported additionally
import 'markdown-navbar/dist/navbar.css';

const article = `# Markdown-Navbar Demo

## Chicken Chicken

Chicken Chicken Chicken Chicken Chicken.

* Chicken Chicken Chicken Chicken Chicken.
* Chicken Chicken Chicken Chicken Chicken.
* Chicken Chicken Chicken Chicken Chicken.

### Chicken Chicken Chicken

Chicken Chicken Chicken Chicken Chicken.

#### Chicken Chicken Chicken Chicken

Chicken Chicken Chicken Chicken Chicken Chicken.`;

function App() {
  return (
    <div className="App">
      <div className="article">
        <ReactMarkdown source={article} />
      </div>
      <div className="navigation">
        <MarkdownNavbar source={article} />
      </div>
    </div>
  );
}

ReactDOM.render(<App />, document.getElementById('root'));

Tips

  • The component only parses article headings at level 2 and below. The article title, which is usually used once in an article, will not appear in the navigation bar.
  • The component needs to be used in conjunction with your article content. When using this component, you must ensure that your article under the same page content.
  • Please confirm that every heading of your markdown document is different by each other when the value of property declarative is setted as true.

Props

Property Data Type Default Value Description
className string "" The className that defines the outermost container of navbar
source string "" Markdown text content
headingTopOffset number 0 Anchor displacement relative to the top of the window (for the anchor jump)
updateHashAuto boolean true Automatically update the hash value of browser address when page scrolling if true
declarative boolean false Use the text of the title from Markdown content as the hash value for the anchor if true
ordered boolean true Whether the title contains a numerical prefix, such as: 1. 2. 2.2
onNavItemClick function (event, element, hashValue) => {} The event callback function after clicking navbar item
onHashChange function (newHash, oldHash) => {} The event callback function before the hash value of browser address changing

License

MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].