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

ginny-mdbook

v0.4.17

Published

Single page markdown website ginny component

Downloads

104

Readme

ginny <MdBook/>

A ginny component for creating a single page HTML book from markdown files.

ginny MdBook example

MdBook HTML result of the example.

Concept

The idea of MdBook is to take a set of markdown files that are usable on their own and render them in a single page book form that is easy to consume and search. It relies on a small number of conventions to extract the title and chapter information out of regular markdown files.

Conventions

  1. (ginny) the site entry point is specified in the package.json main field.
  2. The tsx entry point (typically index.tsx) instantiates single MdBook component passing it the ginny context (see example/src/index.tsx).
  3. The book title and list of markdown files are by default read from a README.md file living next to the tsx entry point file (see Component API for details).
    1. The first-level heading of the index (i.e. README.md) file will become the book title
    2. Any markdown file linked from the main index (i.e. README.md) is included in the book
    3. Any first-level heading in linked markdown files becomes a chapter

Markdown support

MdBook uses the marked markdown library to parse and format markdown files. Additional features on top of regular marked support:

  • mermaid: mermaid diagrams are support using a code block tagged with the mermaid language.
  • katex: katex is used to add support for rendering math. Use $f(x) = x^2$ for inline math rendering, or a code block tagged with the math language for a block of math.
  • If images have a specified title (specified as a quoted text after the image file reference), then this image is rendered as a <figure> with a <figcaption>.

Install

In an existing ginny project:

npm install -s ginny-mdbook

Usage

Once you have a ginny project setup to use MdBook, simply use npx ginny to generate the single page book.

Component API

MdBook component

context property

The context property contains the ginny Context instance, used to derive page context information

index property

This optional property can specify the markdown index file (by default this is README.md) or a user specified object containing an explicit title and list of markdown files to include. Typically reading the index from a markdown file is better because it keeps all the necessary information directly in markdown.

Example

import { PageContext } from "ginny";
import MdBook from "ginny-mdbook";

export default (context: PageContext) => <MdBook context={context} />;