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

@zkochan/remark

v0.1.1

Published

Markdown processor powered by plugins

Downloads

61

Readme

remark

Build Status Coverage Status Inline docs Chat

remark recently changed its name from mdast. Read more about what changed and how to migrate »

remark is a markdown processor powered by plugins. Lots of tests. Node, io.js, and the browser. 100% coverage.

remark is not just another markdown to HTML compiler. It can generate, and reformat, markdown too. Powered by plugins to do all kinds of things: validate your markdown, add links for GitHub references, or add a table of contents.

The project has both an extensive JavaScript API for parsing, modifying, and compiling markdown, and a friendly Command Line Interface making it easy to validate, prepare, and compile markdown in a build step.

Table of Contents

Installation

npm:

npm install remark

Read more about alternative ways to install and use »

Usage

Load dependencies:

var remark = require('remark');
var html = require('remark-html');
var yamlConfig = require('remark-yaml-config');

Use plugins:

var processor = remark().use(yamlConfig).use(html);

Process the document:

var doc = processor.process([
    '---',
    'remark:',
    '  commonmark: true',
    '---',
    '',
    '2) Some *emphasis*, **strongness**, and `code`.'
].join('\n'));

Yields:

<ol start="2">
<li>Some <em>emphasis</em>, <strong>strongness</strong>, and <code>code</code>.</li>
</ol>

API

Get Started with the API »

remark.process(value[, options][, done])

Parse a markdown document, apply plugins to it, and compile it into something else.

Signatures:

  • doc = remark.process(value, options?, done?).

Parameters:

  • value (string) — Markdown document;

  • options (Object) — Settings:

  • done (function(Error?, string?)) — Callback invoked when the output is generated with either an error, or a result. Only strictly needed when asynchronous plugins are used.

All options (including the options object itself) can be null or undefined to default to their default values.

Returns:

string or null: A document. Formatted in markdown by default, or in whatever a plugin generates. The result is null if a plugin is asynchronous, in which case the callback done should’ve been passed (do not worry: plugin creators make sure you know its asynchronous).

remark.use(plugin[, options])

Change the way remark works by using a plugin.

Signatures:

  • processor = remark.use(plugin, options?);
  • processor = remark.use(plugins).

Parameters:

  • plugin (Function) — A Plugin;
  • plugins (Array.<Function>) — A list of Plugins;
  • options (Object?) — Passed to plugin. Specified by its documentation.

Returns:

Object: an instance of Remark: The returned object functions just like remark (it has the same methods), but caches the used plugins. This provides the ability to chain use calls to use more than one plugin, but ensures the functioning of the remark module does not change for other dependents.

CLI

Get Started with the CLI »

Install:

npm install --global remark

Use:

Usage: remark [options] <pathspec...>

Markdown processor powered by plugins

Options:

  -h, --help                output usage information
  -V, --version             output the version number
  -o, --output [path]       specify output location
  -c, --config-path <path>  specify configuration location
  -i, --ignore-path <path>  specify ignore location
  -s, --setting <settings>  specify settings
  -u, --use <plugins>       use transform plugin(s)
  -e, --ext <extensions>    specify extensions
  -w, --watch               watch for changes and reprocess
  -q, --quiet               output only warnings and errors
  -S, --silent              output only errors
  -f, --frail               exit with 1 on warnings
  -t, --tree                input and output syntax tree
  --file-path <path>        specify file path to process as
  --tree-out                output syntax tree
  --tree-in                 input syntax tree
  --no-stdout               disable writing to stdout
  --no-color                disable color in output
  --no-rc                   disable configuration from .remarkrc
  --no-ignore               disable ignore from .remarkignore

See also: man 1 remark, man 3 remark,
  man 3 remarkplugin, man 5 remarkrc,
  man 5 remarkignore, man 7 remarksetting,
  man 7 remarkconfig, man 7 remarkplugin.

Examples:

  # Process `readme.md`
  $ remark readme.md -o readme-new.md

  # Pass stdin(4) through remark, with settings, to stdout(4)
  $ remark --setting "setext: true, bullet: \"*\"" < readme.md > readme-new.md

  # Use a plugin (with options)
  $ npm install remark-toc
  $ remark readme.md --use "toc=heading:\"contents\"" -o

  # Rewrite markdown in a directory
  $ remark . -o

License

MIT © Titus Wormer