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

mimosa-markdown

v1.0.0

Published

Simple mimosa module which render markdown files using marked nodejs module

Downloads

16

Readme

Mimosa Markdown

WARNING I've stopped to maintain this modules, so I'm happy to move the ownership of this repository if somebody is interested in maintaining it, refer to this issue

Overview

This mimosa module allows you to use markdown documents, which will be compiled to html static files. For more information regarding Mimosa, see http://mimosa.io

Warning

This module has been implemented and slightly tested during its development with mimosa 2.0.0-rc9 on Linux.

Usage

Add markdown to your list of modules. That's all! Mimosa will install the module for you when you start up.

Functionality

The module pick the markdown files in the compiled directory (sourceDir property from watch Mimosa configuration section) which have the specified extensions from the extensions option configuration of this module and compile to static html files under the compiled directory (compiledDir property from watch Mimosa configuration section).

Configuration

Default

The default configuration added to your mimosa configuration file when them module is installed is:

markdown: {
  extensions: ['md'],
  options: { }
}

Properties

The only configuraiton properties which pertain itself module is extensions, which is an array with the file extensions that will be considered as markdown documents, so they will be compiled to static html files. Bear in mind that the extensons are just the letters of the extension, it means the dot musn't be typed. The other one configuration paramter is options which is an object which contains the configurations accepted by marked node module, but just providing a syntax sugar on two of them:

  • renderer: This option parameter can be one of the next types:

    • Function: it will be considered that is a constructor, so the constructor must instantiate a valid marked renderer object
    • String: the name of a node module which must export a constructor function under 'Renderer' name. The module will be required as usual, so it can be a dependency module or just a script path which must be relative to the project's root folder
    • Object: a valid marked renderer instance
  • highlight: this options parameter can be one of the next types:

    • Function: the function which performs the syntax highlighting as marked requires
    • String: the name of a node module which must export the function which performs the syntax highlighting as marked requires; it can be a dependency module or just a script path which must relative to the project's root folder

Any syntax sugar provided doesn't modify anything at all over marked options, which the are processed in mimosa and provided to marked as it originally requires.

Example

Here there are some examples for the better understanding of the provided tiny syntax sugar options paramters:

  • Using a node module script under the project's root directory
markdown: {
  options: {
    renderer: './src/my-renderer'
  }
}
  • Using a node module in the dependencies managed by require
markdown: {
  options: {
    renderer: 'non-existing-marked-renderer'
  }
}

Note that non-exiting-marked-renderer should export a constructor under Renderer property (e.g. module.exports.Renderer = function ....)

  • Using a Renderer instance referenced in the same configuration file
var Renderer  = require('non-existing-marked-renderer');
var myRenderer = new Renderer();

....

  markdown: {
   options: {
     renderer: myRenderer
   }
  }
...
  • Using a valid highlight marked function embedded in the same configuration file
function highlightener(code, lang, callback) {
    require('pygmentize-bundled')({ lang: lang, format: 'html' }, code, function (err, result) {
          callback(err, result.toString());
    });
}

....

  markdown: {
    options: {
      highlight: highlightener
   }
  }
....

Under hood

This module doesn't perform any smart operations, just integrate into the mimosa web framework workflow the markdown documents compilation using using marked node module.

License

The MIT License, for more information read the LICENSE file