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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sbjr-react-utils-components/markdown

v4.0.1

Published

A Markdown Renderer for react

Downloads

9

Readme

Sbjr-React-Utils-Components - Markdown - V4.0.0

React image

Sommaire



Description

This module is a A Markdown Renderer for React. this module use markdown-it and the markdown-it-prism plugin to use prism, the syntax highlighting library.

Precondition

This module is a React component.

It depends on it module, so you must have them installed.

NPM

npm i -S react

CDN

<script crossorigin src="https://unpkg.com/react/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom/umd/react-dom.production.min.js"></script>

Installation

NPM

npm i -S @sbjr-react-utils-components/markdown

CDN

<script
  type="text/javascript"
  src="https://unpkg.com/@sbjr-react-utils-components/markdown@latest"
></script>

Usage

Component

Here is a basic example of how to use the Markown Component:

import React from 'react';
import { render } from 'react-dom';
import { Markdown } from '@sbjr-react-utils-components/markdown';

const textInMarkdown =
  '### Markdown Renderer \nContent right in **Markdown** !';

render(
  <Markdown>{textInMarkdown}</Markdown>,
  document.getElementById('react-container'),
);

With cdn:

const textInMarkdown =
  '### Markdown Renderer \nContent right in **Markdown** !';

ReactDOM.render(
  <SbjrRUCMarkdown.Markdown>{textInMarkdown}</SbjrRUCMarkdown.Markdown>,
  document.getElementById('react-container'),
);

Function

Here is a basic example of how to use the Markown function parser.

Example:

import React from 'react';
import { render } from 'react-dom';
import { parseMarkdownToHtml } from '@sbjr-react-utils-components/markdown';

render(
  <div>{parseMarkdownToHtml('Hello **world**')}</div>,
  document.getElementById('react-container'),
);

Docs

This package as 1 component:

  • Markdown

1 function:

  • parseMarkdownToHtml

a default configuration object:

  • MARKDOWN_DEFAULT_CONFIG

And 2 typescript interface:

  • IMarkdownProps.
  • IMarkdownConfig
import {
  Markdown,
  parseMarkdownToHtml,
  MARKDOWN_DEFAULT_CONFIG,
  IMarkdownProps,
  IMarkdownConfig,
} from '@sbjr-react-utils-components/markdown';

Or

const {
  DashbMarkdownoard,
  parseMarkdownToHtml,
  MARKDOWN_DEFAULT_CONFIG,
  IMarkdownProps,
  IMarkdownConfig,
} = window.SbjrRUCMarkdown;

Markdown Props IMarkdownProps

| Props Name | Description | Type | required | | ---------- | ------------------------ | ----------------- | :------: | | children | Markdown String to parse | string | x | | config | Configuration object | IMarkdownConfig | |

parseMarkdownToHtml function parseMarkdownToHtml(content, config)

| Props Name | Description | Type | required | | ---------- | ------------------------ | ----------------- | :------: | | content | Markdown String to parse | string | x | | config | Configuration object | IMarkdownConfig | |

Config

This component uses the MarkdownIt lib, you can modify the markdown configuration.

IMarkdownConfig

| Props Name | Description | Type | required | | ----------- | --------------------------------------------------------------------------------------- | ------------------- | :------: | | html | Enable HTML tags in source | boolean | | | xhtmlOut | Use '/' to close single tags (). | boolean | | | breaks | Convert '\n' in paragraphs into | boolean | | | langPrefix | CSS language prefix for fenced blocks. Can be useful for external highlighters. | string | | | linkify | Autoconvert URL-like text to links | boolean | | | typographer | Enable some language-neutral replacement + quotes beautification | boolean | | | quotes | Double + single quotes replacement pairs, when typographer enabled, and smartquotes on. | string | | | highlight | Highlighter function. Should return escaped HTML | (str, lang) => '' | |

Example:

import React from 'react';
import { render } from 'react-dom';
import Markdown from '@sbjr-react-utils-components/markdown';

// full options list (defaults)
const config = {
  html: false,
  xhtmlOut: false,
  // This is only for full CommonMark compatibility.
  breaks: true,
  langPrefix: 'language-',
  linkify: false,
  typographer: false,

  // Double + single quotes replacement pairs, when typographer enabled,
  // and smartquotes on.Could be either a String or an Array.
  // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
  // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
  quotes: '“”‘’',

  // Highlighter function. Should return escaped HTML
  // or '' if the source string is not changed and should be escaped externally.
  // If result starts with <pre... internal wrapper is skipped.
  highlight: (/* str, lang */) => '',
};

render(
  <Markdown config={config}>Hello **world**</Markdown>,
  document.getElementById('react-container'),
);

To learn more about the options available -> github markdown-it

Exemple

You can see an example here

Have fun