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 🙏

© 2026 – Pkg Stats / Ryan Hefner

astro-md-editor

v0.0.8

Published

Schema-aware editor for Astro content collections.

Readme

Astro MD Editor

npm version

Schema-aware editor for Astro content collections. It lets you edit frontmatter and markdown/MDX together, validates on save, and can reuse values from file Git history.

Demo video: https://www.youtube.com/watch?v=-cI6ct8yLHM

https://github.com/user-attachments/assets/7f38b6a4-fe1a-4e30-80c8-19a58aa860f1

Quick start

npx astro-md-editor
# or
pnpm dlx astro-md-editor

By default, it targets the current directory.

Target a specific Astro project:

astro-md-editor /absolute/path/to/astro-project
# or
astro-md-editor --path /absolute/path/to/astro-project

Root resolution order:

  1. positional argument (astro-md-editor <astro-project-root>)
  2. --path
  3. APP_ROOT_PATH
  4. current working directory

Port can be set with PORT or NITRO_PORT.

PORT=1234 npx astro-md-editor
# or
NITRO_PORT=1234 npx astro-md-editor

Requirements

  • Astro project with collections under src/content
  • Generated collection schemas in .astro/collections/*.schema.json

If schema files are missing, run in the target project:

astro sync

Highlights

  • Reads collection schemas and content files (.md, .mdx, .markdown)
  • Renders schema-aware controls (string, number, boolean, enum, date, arrays)
  • Validates frontmatter with AJV before saving
  • Infers image fields from src/content.config.* (image() / z.array(image()))
  • Supports image pickers for both src assets and public assets
  • Shows per-file Git history and applies selected revision values to the current draft safely

Field overrides (optional)

Create astro-md-editor.fields.json at the Astro project root to force specific UI controls.

{
  "blog": {
    "brandColor": { "type": "color" },
    "coverAssetPath": { "type": "image", "mode": "public" },
    "menuIconFiltered": { "type": "icon", "icon_libraries": ["lucide", "mdi"] },
    "menuIconAny": { "type": "icon" }
  },
  "snippet": {
    "galleryPaths": { "type": "image", "multiple": true, "mode": "public" }
  }
}

Supported override types:

  • image (mode: "asset" | "public", optional multiple: true)
  • color
  • icon (optional icon_libraries: string[])

Precedence: astro-md-editor.fields.json > inferred image() fields > schema defaults.

Invalid or schema-incompatible overrides are ignored with startup warnings.

Notes

  • Applying Git history updates the in-editor draft only; files are written only on normal Save
  • public assets are saved as /path/from/public
  • src assets are saved relative to the edited content file (./... or ../...)
  • Icon values are saved as Iconify IDs (for example lucide:messages-square)
  • Custom controls currently target top-level frontmatter fields

Add a custom UI handler in code

If you are extending the editor itself (not just using astro-md-editor.fields.json), add a new field kind in these places:

  1. src/lib/schema-form.ts

    • Extend FieldUiKind, FieldUiConfig, and ResolvedField
    • Update resolveCustomFieldKind to map your override kind to a resolved field
  2. scripts/bootstrap-collections.mjs

    • Extend fieldOverrideSchema so config accepts your new type
    • Update getOverrideConfig and resolveSchemaCompatibilityKind
  3. src/components/editor/RightSidebar.tsx

    • Add your new field component
    • Render it in the resolvedFields.map(...) switch (field.kind === '<yourKind>')
  4. src/lib/frontmatter-history-merge.ts

    • Update isCompatibleValue so Git-history apply validates your new kind correctly

Quick checklist for a new kind (example: slug):

  • add slug to schema/field types
  • parse type: "slug" in bootstrap overrides
  • render <SlugField /> in RightSidebar
  • add compatibility logic in history merge

If any part is missing, the field falls back to default/unsupported handling.