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

@dataset.sh/doc3

v0.0.4

Published

A file-based headless content management library.

Downloads

5

Readme

DocDocDoc

A file-based headless content management library. suitable for managing documentation site and blog.

API

import {Doc3} from "@dataset.sh/doc3"

const doc3 = Doc3('./')
doc3

Folder structure

doc3 manage content entirely based on

- Folder
    - sidebar.yaml (optional)
    - article1.md
    - article2.mdx
    - 2023-06-06-article3.mdx (article with date prefix)
    - sub-folder
        - article1.md
        - article2.mdx
        - 2023-06-06-article3.mdx (article with date prefix)

Article

This package use gray-matter to extract metadata from each md or mdx files.

Metadata

The following metadata fields are required, and will be automatically generated if missing from front matter.

  • title: Title of the article, must be provided.
  • slug: slug of the article, the package will first try to read from front matter then filename.
  • date: Date of the article, the package will first try to read from front matter, and then filename pattern yyyy-mm-dd-slug.md, then modifiedAt.
  • modifiedAt: When is this article modified, the package will first try to read from front matter, then from fs.stat.

The following metadata fields will be generated, but can be disabled by certain flags.

  • readingTime: Will be calculated based on estimated token count.

sidebar.yaml

You can define a sidebar layout in this file, which is normally used in documentation sites. For example:

---
- title: Intro
  slug: intro
- title: Tutorial
  slug: tutorial
- title: Advance
  slug: advance
  children:
    - title: Engine
      slug: advance/engine
    - title: Control
      slug: control

The slug fields of children elements don't have to share url prefix of its parent, for example, if parent node has slug advance, one of its children can have the url advance/engine, and another can have not-advance/some-doc.

This yaml file should contain ContentNode[] as defined below.

type ContentNode = {
    name: string,
    slug?: string,
    children?: ContentNode[]
}

Advance Pattern

With doc3, you can easily implement i18n, multiple versioning, and multiple software in one site.

doc3 offers great flexibility and should work for you no matter what i18n, versioning systems you are using.

The easiest way to achieve features such as i18n is to store different version of your content in different folders and load the corresponding folder when needed. In that way, doc3 should be flexible enough to work with any i18n setups.

I18N

let locale = 'fr'
const doc3 = Doc3(`locale/${locale}`)

Versioning

let version = '1.0.0'
const doc3 = Doc3(`version/${version}`)

Multiple Software Documentation in One Site

let libname = '...'
const doc3 = Doc3(`lib/${libname}`)

CLI

We also include a cli app, which can be useful for debugging your content folder.

npx doc3 -h
npx doc3 list ./              # list documents
npx doc3 list ./ -t [tag]     # list documents by tag
npx doc3 list-tags ./         # list tags
npx doc3 print ./ [slug]      # get article for slug
npx doc3 print ./ [slug] -m   # get article for slug, but only print metadata
npx doc3 print ./ [slug] -c   # get article for slug, but only print content