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

slidemd

v1.1.0

Published

A fast and lightweight CLI tool to present your Markdown.

Downloads

8

Readme

Why?

reveal.js is a fantastic presentation tool with built-in Markdown support (and many other features), only it can be a little hassle to present external Markdown files. After trying out reveal-md, which is also great, I personally find it a little heavy.

And most of the time when I present, I'd like to reference some local images in my markdown.

So here comes Slidemd. It's tiny, and fully-featured.

Installation

npm i -g slidemd
# or
yarn add -g slidemd

The installation can be skipped if you're using npx.

Usage

slidemd /path/to/your/slides.md
# or, for npx users
npx slidemd path/to/your/slides.md

Then your default browser will automatically open http://localhost:8080.

Happy presenting!

Reference local images

Running slidemd will also serve the the files within the current working directory, so you can reference images alongside your markdown.

For example, suppose the following directory:

$ tree .
.
├── my-slides.md
├── image1.png
└── image2.png

inside my-slides.md, you can reference image1.png and image2.png like this:

# My awesome slides

![](image1.png)

---

![](image2.png)

CLI options

For simplicity's sake, Slidemd doesn't feature a load of CLI options, only some "must-have" ones.

Run slidemd -h to list the supported CLI options:

$ slidemd -h
Usage: slidemd [options] <file>

A fast and lightweight CLI tool to present your Markdown.

Options:
  -V, --version                    output the version number
  -p, --port <port>                port number of the local server (default: "8080")
  -t, --theme <theme>              theme of the slides (default: "black")
  -o, --optionsFile <optionsFile>  JSON file of reveal.js config and additional options
  -c, --cssFile <cssFile>          CSS file of custom styles to a specified theme
  -h, --help                       display help for command

--theme

alias: -t required: ✗ default: black

--theme specifies a built-in theme of your slides. You can pass a CSS file via --cssFile option to add some custom styles to your slides.

If a custom theme is what you need, you'll have to follow reveal.js's official guide.

--port

alias: -p required: ✗ default: 8080

--port determines the port number of the local server that Slidemd creates after running slidemd.

--optionsFile

alias: -o required: ✗

reveal.js exposes a wide range of customizable config options to customize presentation behaviors, and Slidemd supports them all.

To configure reveal.js options, specify them (like progress, controls, and so on) in a JSON file via the --optionsFile CLI option.

slidemd /path/to/your/slides.md -o /path/to/your/optionsFile.json

In additional to reveal.js built-in configurations, there are some extra options you can put in the JSON file:

| Config option | Default value | Description | | ------ | ------ | ------ | | separator | ^\r?\n---\r?\n$ | regex for horizontal slides | | separatorVertical | ^\r?\n--\r?\n$ | regex for vertical slides | | notes | ^notes?: | regex for speaker view notes |

--cssFile

alias: -c required: ✗

--cssFile specifies a local CSS file to add some more custom styles to your selected theme.

reveal.js

Here are some notes on how Slidemd configures and initializes reveal.js.

Plugins

Slidemd enables the following reveal.js plugins:

Sorry but it's not possible to customize plugins using Slidemd, if you need more fine-grained customization, please checkout reveal.js's official guide.

Markdown

Slidemd uses reveal.js's data- attributes under the hood to specify how a Markdown file's slides are delimited.

The default values are:

  • data-separator - ^\r?\n---\r?\n$
  • data-separator-vertical - ^\r?\n--\r?\n$

To customize, see --optionsFile for more details.

Speaker notes

RevealNotes plugin is used for speaker view, and the regex to determine notes is:

  • data-separator-notes - ^notes?:

To customize, see --optionsFile for more details.

NodeJS API

Slidemd also exposes a NodeJS API.

import slidemd from 'slidemd';

// Create a local server to present your Markdown file
slidemd(
  options: {
    // file path, will be resolved relative to `options.cwd`
    file: string;
    // current working dir, defaults to `process.cwd()`
    cwd?: string;
    port?: string;
    theme?: string;
    // options JSON file, same as `--optionsFile` CLI option
    optionsFile?: string;
    // CSS file, same as `--cssFile` CLI option
    cssFile?: string;
  },
  callback?: () => void
);

License

MIT