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

mmarkdown

v1.0.0

Published

Caffeinated markdown

Downloads

41

Readme

mmarkdown

Caffeinated markdown ☕️

Interpret mmd fenced code blocks in a markdown file and generate a cooler version of it.

mmd fenced code block

const name = 'Jessie'
const hello = '#### Hello '

return hello + name

output:

Hello Jessie

Table of Contents

Install

yarn add mmarkdown --dev

Config package.json (defaults)

{
    "mmarkdown": {
      "src": "./Readme/Readme.md",
      "out": "./Readme.md",
      "scripts": "./Readme/Readme.js",
      "backup": "true",
      "backupPath": "./Readme/backup/"
    }
}
{
  "scripts":{
    "make-readme": "markdown"
  }
}

Command line arguments

| argument | description | default | | ---------- | ------------------------------ | --------------------- | | src | Source md file | ./ReadmeSrc/Readme.md | | out | Output md file | ./Readme.md | | scripts | Helper JS file | ./ReadmeSrc/Readme.js | | backup | Do a backup of the output file | false | | backupPath | backup path | ./ReadmeSrc/backup/ | | help | Show help | | | version | Show version number | |

{
  "scripts":{
    "make-readme": "markdown --backup --backupPath ./backupReadme/"
  }
}

Usage

Mmarkdown takes a plain markdown file and generates a copy of it.

It starts to be less boring when you add fenced code blocks with the language identifier set to mmd.

Everything that is returned (as a string) from the code in the block will be interpreted and replaced to the block in the output file.

It's full async, which is cool, lots of awaits are waiting for you there but soon enough you will face a problem: too much code to write in a markdown file! Terrible experience!

The solution in mmarkdown is in the scripts option. The module that the scripts file returns will be passed to the context of the fenced block, see example 3.

The backup option, false by default, will make a copy of the current output file, postfix it with a timestamp and move it into backupPath.

Example 1

mmd fenced code block:

const hello = message => {
  return message
}

return hello('### hippieeeeee hippie yeeeee!!!!!!!!')

output:

hippieeeeee hippie yeeeee!!!!!!!!

Example 2

mmd fenced code block:

const array = [1, 3, 5]

return array.map(item => '## ' + item).join('\n\n')

output:

1

3

5

Example 3, with Scripts

this file is passed to mmarkdown with the scripts option.

mmd fenced code block:

//scripts is passed

const array = [1, 3, 5]

const something = await scripts.processMyArray(array)

const myFinalString = something.map(item => '## ' + item.name)
  .join('\n\n')

return myFinalString

output:

1 async

3 async

5 async

Demo / Boilerplate

The file you are reading right now is generated starting this other file.

For a kind of boilerplate repo instead, have a look at this repo.

Maintainers

@albinotonnina

Contribute

PRs accepted.

License

MIT © 2018 Albino Tonnina