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

markdown-decorator

v1.0.0

Published

A lightweight utility for inserting text into markdown files and templates.

Downloads

2

Readme

markdown-decorator

[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] Windows build status Dependency Status Codacy Badge Coverage percentage [![License][license-image]][license-url]

A lightweight utility for inserting text into markdown files and templates.

Table of contents

1. Installation

$ npm install --save markdown-decorator

2. Usage

2.1. Pass a markdown string to its constructor

const MarkdownDecorator = require('markdown-decorator')
const fs = require('fs')
const pkg = require('./package')

const decorator = new MarkdownDecorator(fs.readFileSync('README.md'))

2.2. Insert your product's (semantic) version

## Version and CHANGELOG

`markdown-decorator`'s latest version is
<!-- semver -->
<!-- semverend -->.
Please read the [CHANGELOG][changelog-url] for details.
// pkg.version === '1.1.0-alpha.1'
decorator.semver(pkg.version)

Inserts the semver:

## Version and CHANGELOG

`markdown-decorator`'s latest version is
<!-- semver -->1.1.0-alpha.1<!-- semverend -->.
Please read the [CHANGELOG][changelog-url] for details.

2.3. Generate a table of contents

Use toc comment tags as delimiters:

## Table of contents
<!-- toc -->
<!-- tocend -->
decorator.toc(markdown)

2.4. Method chaining

const md = decorator
  .semver(pkg.version)
  .toc(markdown)
  .toString()

2.5. Templates

<%= header %>
<%= body %>
---
<%= footer %>

Use the decorate method with an object literal to insert values in your template:

const md = decorator.decorate({
  version: '1.0.0'
})
.toString({
  template,
  header: '# TEMPLATE HEADER',
  body: decorator.markdown,
  footer: 'TEMPLATE FOOTER'
})

2.6. Insert a string between delimiters

# `<!-- title --><!-- titleend -->`
decorator.insert('markdown-decorator', {
	open: 'title',
	close: 'titleend'
})
decorator.markdown
// => # `<!-- title -->markdown-decorator<!-- titleend -->`

3. Version and CHANGELOG

markdown-decorator is at v1.0.0. Please see the CHANGELOG for details.

4. Contributing

[![PRs Welcome][makeapullrequest-image]][makeapullrequest-url] We welcome contributors and pull requests. Check out the guidelines for

Contributions are stories with a beginning, a middle, and an end, all told through issues, comments, commit logs, and pull requests.

  • [Peruse open issues][issues-url] or
  • [Open a new pull request (PR)][pr-url]

5. License

[![License][license-image]][license-url] © Greg Swindle


Greenkeeper badge

[issues-url]: (https://github.com/gregswindle/markdown-decorator/issues [license-image]: https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat [license-url]: ./LICENSE [makeapullrequest-image]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square [makeapullrequest-url]: http://makeapullrequest.com [new-issue-url]: https://github.com/gregswindle/markdown-decorator/issues/new [npm-image]: https://badge.fury.io/js/markdown-decorator.svg [npm-url]: https://npmjs.org/package/markdown-decorator [pr-course-url]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github [pr-url]: https://github.com/gregswindle/markdown-decorator/pulls [pr-url]: https://github.com/gregswindle/markdown-decorator/pulls [standard-version-url]: https://github.com/conventional-changelog/standard-version [travis-image]: https://travis-ci.org/gregswindle/markdown-decorator.svg?branch=master [travis-url]: https://travis-ci.org/gregswindle/markdown-decorator