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

single-page-markdown-website

v0.0.25

Published

Create a nice single-page documentation website from one or more Markdown files

Downloads

160

Readme

Single-Page Markdown Website

Create a nice single-page documentation website from one or more Markdown files

Features

  • Zero configuration
  • Render a table of contents, shortcuts to the top-level sections, and custom links
  • Include the contents of other Markdown files using a special syntax
  • Responsive from mobile and up
  • Dark mode (follows system settings)

Quick start

Requires Node.js.

$ npx --yes -- single-page-markdown-website '*.md' --open

The above command does the following:

  • Concatenates the given globs of Markdown files ('*.md') and renders the result as a single-page website to ./build/index.html.
  • Copies any local image file referenced in the Markdown to ./build/images.
  • Opens the rendered page in your default web browser.

Configuration

Configuration is via the "single-page-markdown-website" key of your package.json file.

  • Single-Page Markdown Website works without configuration out of the box; all configuration options are optional.
  • Some configuration options default to values specified in your package.json or lerna.json.
{
  "single-page-markdown-website": {
    "baseUrl": "https://yuanqing.github.io/single-page-markdown-website/",
    "title": "Single-Page Markdown Website",
    "description": "Create a nice single-page documentation website from one or more Markdown files",
    "toc": true,
    "sections": true,
    "links": [
      {
        "text": "GitHub",
        "url": "https://github.com/yuanqing/single-page-markdown-website"
      }
    ],
    "faviconImage": "media/favicon.svg",
    "shareImage": "media/share.png"
  }
}

"baseUrl"

(null or string)

The base URL of the single-page website.

  • Defaults to null

"title"

(null or string)

The title of the page.

  • Defaults to packageJson.name, else null

"description"

(null or string)

The meta description of the page.

  • Defaults to packageJson.description, else null

"toc"

(boolean)

Whether to render a Table of Contents.

  • Defaults to true

"sections"

(boolean)

Whether to render sections shortcuts in the menu. (Sections are the level-one headers (# ) in the Markdown.)

  • Defaults to true

"links"

(Array<{ text: string, url: string }>)

A list of links to add to the menu.

  • Defaults to [{ text: 'GitHub', url: packageJson.homepage }], else null

"faviconImage"

(null or string)

The URL or file path of the favicon image to use.

  • Defaults to null

"shareImage"

(null or string)

The URL or file path of the share image to use.

  • Defaults to null

"version"

(null or string)

The version number to show beside the title.

  • Defaults to v${lernaJson.version}, else v${packageJson.version}, else null

Tips

Including files

Use the following syntax to include the entire contents of a local file foo.md in your Markdown:


./foo.md

Note that an empty line is required immediately before and after the file path.

  • If the ./ prefix is used, then the file path is resolved relative to the current Markdown file.
  • If the / prefix is used, then the file path is resolved relative to the current working directory (ie. process.cwd()).

You can also specify a glob to include multiple files:


./bar/*.md

Deploying to GitHub Pages

Deploy your single-page website to GitHub Pages via one of the following two ways:

  1. Commit the ./build directory and push your changes. Then, set the ./build directory as the publishing source in your GitHub repository settings.

  2. Use the gh-pages CLI to deploy the ./build directory to the gh-pages branch:

    $ npx --yes -- gh-pages --dist build

    Then, set the gh-pages branch as the publishing source in your GitHub repository settings.

Deploying to Cloudflare Pages

To deploy your single-page website to Cloudflare Pages, use the following settings in your build configuration:

  • Build command: exit 0
  • Build output directory: /build
  • Root directory: /

CLI


  Create a nice single-page documentation website from one or more Markdown files.

  Usage:
    $ single-page-markdown-website <files> [options]

  Arguments:
    <files>  One or more globs of Markdown files. Defaults to 'README.md'.

  Options:
    -h, --help     Print this message.
    -p, --open     Whether to open the generated page in the default web
                   browser. Defaults to 'false'.
    -o, --output   Set the output directory. Defaults to './build'.
    -v, --version  Print the version.
    -w, --watch    Whether to watch for changes and regenerate the page.
                   Defaults to 'false'.

  Examples:
    $ single-page-markdown-website
    $ single-page-markdown-website '*.md'
    $ single-page-markdown-website --open
    $ single-page-markdown-website --output dist
    $ single-page-markdown-website --watch