npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-markplus

v0.1.3

Published

A React markdown editor and previewer.

Downloads

219

Readme

MarkPlus

A React markdown editor and previewer.

Online Demo

Installation

yarn add react-markplus

Usage

import MarkPlus from 'react-markplus';

<MarkPlus markdown="# Hello world!" />;

markdown

Initial markdown text to load into the editor.

<MarkPlus markdown="# Hello world!" />

Default value is ''.

toolbar

Show, hide or remove toolbar.

<MarkPlus toolbar="show" />

3 possible values:

  • show: show toolbar, show a gutter below toolbar. Click the gutter to hide toolbar.
  • hide: hide toolbar, show a gutter on top. Click the gutter to show toolbar.
  • none: no toolbar, no gutter.

Default value: show.

mode

Display editor, preview or both.

<MarkPlus mode="both" />

3 possible values:

  • both: show both editor and preview
    • there is a vertical gutter between editor and preview, you may drag the gutter to adjust sizes of them.
  • editor: show editor only
  • preview: show preview only
    • Use this mode if you don't need any editing feature.
    • in this mode this library is a markdown renderer.

Default value: both.

theme

Overall theme: light, dark or auto:

<MarkPlus theme="auto" />

3 possible values:

  • light: light theme
  • dark: dark theme
  • auto: same as system theme

Default value: auto.

toolbarItems

You may configure the toolbar freely.

<MarkPlus toolbarItems={['about', '|', 'bold', 'italic']} />

A toolbar item could be either a string or a ReactElement. For toolbar items included with library, you may just specify a string. For your own custom toobar items, please specify a ReactElement.

Included toolbar Items

  • 'about'
    • show a modal about MarkPlus
  • '|'
    • a vertical separator
  • 'bold'
    • make text bold
  • 'italic'
    • make text italic
  • 'strikethrough'
    • make text strokethrough
  • 'underline'
    • make text underlined
  • 'mark'
    • make text marked
  • 'emoji'
    • show a modal to insert emojis
  • 'fontawesome'
    • show a modal to insert fontawesome icons
  • 'quote'
    • quote text
  • 'unordered-list'
    • create unordered list item
  • 'ordered-list'
    • create ordered list item
  • 'unchecked-list'
    • create unchecked task list item
  • 'checked-list'
    • create checked task list item
  • 'link'
    • insert a link
  • 'image'
    • insert a image
  • 'code'
    • insert a code snippet
  • 'table'
    • insert a table
  • 'math'
    • insert some math formulas
  • 'mermaid'
    • insert some mermaid charts
  • 'chartjs'
    • insert some Chart.js charts

Default toolbar items

import { defaultToolbarItems } from 'react-markplus';

Its value is:

[
  'about',
  '|',
  'bold',
  'italic',
  'strikethrough',
  'underline',
  'mark',
  '|',
  'emoji',
  'fontawesome',
  '|',
  'quote',
  'unordered-list',
  'ordered-list',
  'unchecked-list',
  'checked-list',
  '|',
  'link',
  'image',
  'code',
  'table',
  '|',
  'math',
  'mermaid',
  'chartjs',
];

You may add or remote items from it to customize your own toolbar.

Custom toolbar item

Here is a sample to create and insert a custom toolbar item:

<MarkPlus
  toolbarItems={[
    'about',
    '|',
    <i
      key="preferences"
      title="Preferences"
      className="fa fa-cog"
      onClick={() => {
        console.log('Todo: display a preferences modal');
      }}
    ></i>,
  ]}
/>