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

blueprint-markdown-renderer

v2.0.2

Published

Default parser and set of settings for parsing and rendering Markdown blocks in API Blueprint

Downloads

9

Readme

Blueprint Markdown Renderer

Default parser and set of settings for parsing and rendering of Markdown blocks in API Description Documents.

Installation

$ npm install blueprint-markdown-renderer

Usage

Basic Rendering

import { renderHtml } from 'blueprint-markdown-renderer';

const mdText = '# Heading';

const html = renderHtml(mdText);

console.log("Rendered HTML: ", html);

Advanced Usage

Note that if you alter renderer's settings, you are potentially diverging from the ecosystem, therefore this is not encouraged. However, it's still better to share the same rendering core with customised behaviour than it is to start for the blank slate.

Blueprint Markdown Renderer uses markdown-it under the hood. See markdown-it API Documentation to find all available options how to change renderer.

import { renderHtml, rendererFactory, sanitize } from 'blueprint-markdown-render';
import emojiPlugin from 'markdown-it-emoji';

const renderer = rendererFactory();

// alter default options
renderer.set({ langPrefix: 'lang-', breaks: true });

// add own plugin
renderer.use(emojiPlugin);

const mdText = ':smiley:';

const html = renderHtml(mdText, {
  renderer, // custom renderer
  env, // additional data from parsed input (references, for example)
  sanitize, // run HTML sanitization function
});

console.log("Rendered HTML: ", html);

Motivation

While API Blueprint syntax is based on Markdown, it doesn't care about the (Markdown) content of description blocks. The reference parser actually preserves the source Markdown in the produced API Elements. Same logic applies to

This library is intended to provide a consistent API for parsing those Markdown blocks. Use it to get the same defaults and consistent rendering with the rest of JavaScript API Blueprint ecosystem.

To get consistent experience accross languages, this library uses CommonMark implementation under its hood. Following extensions to default rendering is enabled by default:

Development

$ npm install
$ npm test

This package is using Semantic Release.

Please use proper commit message format.

License

MIT (see LICENSE file)

Apiary Czech Republic, s.r.o. [email protected]