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

02strich-markdown

v1.0.2

Published

ReadMe's React-based Markdown parser

Downloads

435

Readme

@readme/markdown

ReadMe's flavored Markdown parser and MDX rendering engine.

npm install --save @readme/markdown

Usage

By default, the updated markdown package exports a function which takes a string of ReadMe-flavored markdown and returns a tree of React components:

import React from 'react';
import rdmd from "@readme/markdown";

export default ({ body }) => (
  <div className="markdown-body">
    {rdmd(body)}
  </div>
);

Export Methods

In addition to the default React processor, the package exports some other methods for transforming ReadMe-flavored markdown:

| Export | Description | Arguments | | -------:|:---------------------------------------------- |:--------------- | |react|(default) returns a VDOM tree object |text, options| |md | transform mdast in to ReadMe-flavored markdown |tree, options| |html | transform markdown in to HTML |text, options| |mdast| transform markdown to an mdast object |text, options| |hast | transform markdown to HAST object |text, options| |plain| transform markdown to plain text |text, options| |utils| contexts, defaults, helpers, etc. | N/A |

Settings & Options

Each processor method takes an options object which you can use to adjust the output HTML or React tree. These options include:

  • compatibilityMode — Enable compatibility features from our old markdown engine.
  • copyButtons — Automatically insert a button to copy a block of text to the clipboard. Currently used on <code> elements.
  • correctnewlines — Render new line delimeters as <br> tags.
  • markdownOptions — Remark parser options.
  • safeMode — Render html blocks as <pre> elements. We normally allow all manner of html attributes that could potentially execute JavaScript.

Flavored Syntax

Our old editor rendered "Magic Block" components from a custom, JSON-based syntax. To provide seamless backwards-compatibility, our new processor ships with built in support for parsing this old format, and transpiles it straight in to our new, flavored Markdown.

We've also sprinkled a bit of our own syntactic sugar on top to let you supercharge your docs. Learn more about ReadMe's flavored syntax!

Local Development

To make changes to the RDMD engine locally, run the local development server. Clone the repo, cd in to it, npm install, and npm run start!

Environment setup

Running the browser tests requires docker. Follow the docker install instructions for mac. You may want to increase the memory usage. If you have not already, you'll need to create an account for docker hub and sign-in locally.

Running visual regression tests

If you make changes to the docs or how the markdown is rendered, you may need to update the visual regression snapshots. You can run the visual regression tests in a docker container with:

make updateSnapshot

Credits