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

@ipikuka/react-markdown

v1.0.5

Published

It is an opinionated wrapper for the 'react-markdown' package

Downloads

9

Readme

@ipikuka/react-markdown

NPM version Build npm-typescript License

This package is an opinionated wrapper of the react-markdown package that written by wooorm.

When should I use this?

The @ipikuka/react-markdown provides the <ReactMarkdown /> component which is an opinionated wrapper of the <ReactMarkdown /> component of the react-markdown, which is a React component to render markdown.

The remark plugins used in the @ipikuka/react-markdown are:

  • remark-definition-list
  • remark-emoji
  • remark-fix-guillemets
  • remark-flexible-code-titles
  • remark-flexible-containers
  • remark-flexible-markers
  • remark-flexible-paragraphs
  • remark-gemoji
  • remark-gfm
  • remark-ins
  • remark-smartypants
  • remark-supersub
  • remark-textr-sync (custom)
  • remark-textr-plugins (custom)

The rehype plugins used in the @ipikuka/react-markdown are:

  • rehype-autolink-headings
  • rehype-prism-plus
  • rehype-slug
  • rehype-raw
  • rehype-pre-language (custom)

Installation

This package is suitable for ESM module only. In Node.js (16.0+), install with npm:

npm install @ipikuka/react-markdown

or

yarn add @ipikuka/react-markdown

Usage

This package is peer dependant with react, @types/react. So, it is assumed that you have already installed them in your project.

import React from 'react'
import ReactDom from 'react-dom'
import ReactMarkdown from '@ipikuka/react-markdown'

ReactDom.render(<ReactMarkdown># Hello, *world*!</ReactMarkdown>, document.body)

Options

The @ipikuka/react-markdown component accepts the OpinionatedReactMarkdownOptions which is similar to ReactMarkdownOptions of the react-markdown, but a little bit opinionated.

All options are optional.

type OpinionatedReactMarkdownOptions = {
  children?: string; // default: ''
  className?: string; // default: undefined
  components?: Record<string, Component>; // default: {}
  skipHtml?: boolean; // default: false
};

See the detailed explanation of the options from the link https://github.com/remarkjs/react-markdown#props

All the other options of the react-markdown are opinionated, so you can not set the rest of the options like remarkPlugins or rehypePlugins. This is why the @ipikuka/react-markdown is opinionated, providing some pre-selected plugins.

The omitted options from the official react-markdown are represented below (See https://github.com/remarkjs/react-markdown#props).

{
  remarkPlugins?: PluggableList | undefined;
  rehypePlugins?: PluggableList | undefined;
  remarkRehypeOptions?: Options | undefined;
  allowedElements?: string[] | undefined;
  disallowedElements?: string[] | undefined;
  allowElement?: AllowElement | undefined;
  unwrapDisallowed?: boolean | undefined;
  sourcePos?: boolean | undefined;
  rawSourcePos?: boolean | undefined;
  includeElementIndex?: boolean | undefined;
  transformLinkUri?: false | TransformLink | null | undefined;
  transformImageUri?: TransformImage | undefined;
}

If you think that an omitted option is needed, you are wellcome to open an issue.

Examples:

All the examples given in the link https://github.com/remarkjs/react-markdown#examples are valid, but YOU DON'T NEED TO PROVIDE ANY PLUGIN since the @ipikuka/react-markdown provides some pre-selected plugins by default for you.

Needs a playground with single page web application. (PR is wellcome)

Types

This package is fully typed with TypeScript. The <ReactMarkdown /> component of the @ipikuka/react-markdown accepts OpinionatedReactMarkdownOptions.

Compatibility

It is a React@^18 compatible package.

Security

License

MIT © ipikuka

Keywords

remark react-markdown