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

qwik-markdown

v0.0.20

Published

A helpful utility for creating Markdown files and validating their frontmatter in Qwik City apps.

Downloads

114

Readme

Qwik Markdown

🚨 Requires Qwik v1.2.8 or higher.

Available Commands

generate, g

Generate a Markdown route

validate, v

Validate frontmatter using Valibot

Setup

Both of the commands above require you to define Valibot schemas in the root of your routes that contain Markdown routes.

Say you have a tree structure like this:

src
  routes
    posts
      schema.ts
      hello-world
        index.md

In schema.ts, you might have a Valibot schema like this:

import { object, string, minLength } from "valibot";

export const schema = object({
  title: string([minLength(1, "Title required")]),
});

Let's say your hello-world/index.md contains this:

This is my first post!

If you run qwik-markdown validate, it will fail because you don't have a title defined. So change the front matter to:

---
title: "Hello World"
---

If you run qwik-markdown validate again, validation will pass and nothing will be displayed. Helpful to run before qwik build to ensure all your Markdown files have the necessary frontmatter defined.

Generate New Markdown Routes

With your schema.ts files set up, Qwik Markdown can infer the type of frontmatter you need for each route. If you run qwik-markdown generate, a series of prompts will be shown to gather info about the filename to use and each frontmatter value to be used. The filename you provide should:

  1. Consist of numbers or lowercase letters, separated by hyphens
  2. End in .md or .mdx

If you provide a filename like my-second-post.md, you'll get a new route at src/routes/posts/my-second-post/index.md. The frontmatter will then be populated with the values you provide in the following prompts.

Known Issues

  • [ ] generate command is interactive-only. May support passing command-line params in the future.
  • [ ] validate errors aren't formatted as well as they could be. Will be addressed in the future.
  • [x] ~Doesn't check if Qwik 1.2.8 or higher is installed.~
  • [ ] If you want to have a non-string or non-boolean type like date(), you'll need to use coerce.