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

chains-markdown

v0.1.6

Published

Compile markdown to html. GFM and code highlighting support!

Downloads

16

Readme

chains-markdown

This grunt task takes a set of markdown files and converts them to HTML. It supports GFM with code highlighting. The code highlighting is done using highlight.js.

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with:

npm install grunt-markdown --save-dev

Then add this line to your gruntfile:

grunt.loadNpmTasks('chains-markdown');

Documentation

Creating a markdown task is simple. For the basic functionality add the following config in your gruntfile:

grunt.initConfig({
  markdown: {
    all: {
      files: [
        {
          expand: true,
          src: 'docs/src/*.md',
          dest: 'docs/html/',
          ext: '.html'
        }
      ]
    }
  }
});

Here is an example config using all of the options:

grunt.initConfig({
  markdown: {
    all: {
      files: [
        {
          expand: true,
          src: 'docs/src/*.md',
          dest: 'docs/html/',
          ext: '.html'
        }
      ],
      options: {
          gfm: true,
          highlight: manual,
          codeLines: {
            before: '<span>',
            after: '</span>'
          }
      }
    }
  }
});

These are the properties that the markdown task accepts:

Note: If you specify multiple files to one dest file, chains-markdown will concat all files and output to the dest file.

Options

Options passed directly to the markdown parser.

  • pedantic: Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
  • gfm: Enable github flavored markdown (enabled by default).
  • sanitize: Sanitize the output. Ignore any HTML that has been input.
  • highlight: A callback to highlight code blocks.
  • tables: Enable GFM tables. This is enabled by default. (Requires the gfm option in order to be enabled).
  • breaks: Enable GFM line breaks. Disabled by default.
  • smartLists: Use smarter list behavior than the original markdown. Disabled by default. May eventually be default with the old behavior moved into pedantic.
  • smartypants: Use "smart" typograhic punctuation for things like quotes and dashes.
  • langPrefix: Set the prefix for code block classes. Defaults to lang-.

Most markdown options are passed as-is to the marked markdown parser. The only option that is processed prior to compiling the markdown is the highlight option. If you specify auto or manual the task will handle highlighting code blocks for you use highlight.js. If you pass a custom function as the highlight option it will be used to highlight the code.

  • auto: Will try to detect the language
  • manual: will pass the language name from markdown to the highlight function
  • codeLines: specify text that should wrap code lines

License

Copyright (c) 2013 WangSai Licensed under the MIT license.