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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lex-md

v0.1.0

Published

Converts Bluesky Lexicon JSON files to Markdown

Downloads

2,577

Readme

Lex M.D.

Transform ATProto Lexicon files into well-formatted, linkable Markdown documents, perfect for automatic documentation generation.

Validates your lexicons against the official Lexicon specification.

Only guaranteed to work against Node 20.9 and later.

Configuration

const config: Config = {
  prefixLinkTable: {
    // Link place.stream definitions to /reference/placestream* paths
    "place.stream": (nsid: string) => {
      return `/reference/${nsid.toLowerCase().replaceAll(".", "")}`;
    },
    // No special linking for app.bsky or com.atproto refs
    "app.bsky": null,
    "com.atproto": null,
    // Add more custom link rules here
  },
  // Set to false to omit the source JSON block from output
  includeSourceJson: true,
  // Change the default separator used in markdown filenames
  defaultLexiconSeparator: "-",
  // Path *relative to main.ts* where Zod types are defined.
  // MUST match the actual import in main.ts!
  typesImportPath: "./types.ts",
};

export default config;
  • prefixLinkTable:
    • Keys are the first two segments of a Lexicon NSID (e.g., "com.atproto").
    • Values are either:
      • A function (nsid: string) => string that takes the full Lexicon NSID and returns the desired Markdown link URL.
      • null to indicate no special linking; the reference will just be displayed as code (\com.atproto.repo.strongRef``).
  • includeSourceJson:
    • true: Appends the original Lexicon JSON definition in a fenced code block at the end of the Markdown.
    • false: Omits the source JSON block.
  • typesImportPath:
    • A string representing the path to your Zod types definition file, relative to main.ts.
    • Crucial: This path is used as a hint in logs and error messages. You must ensure the static import * as BskyLex from '...' statement at the top of main.ts uses the correct, corresponding path. ES Modules require static paths for imports.

Usage

Run the script from your terminal using Deno, providing the input and output directories as arguments. You need to grant read permissions for the input directory/types file and write permissions for the output directory.

lexmd <path/to/input-lexicons> <path/to/output-markdown>

Example:

# Process JSON files in ./lexicons/ and write Markdown to ./docs/reference/
lexmd ./lexicons ./docs/reference
  • <path/to/input-lexicons>: The directory containing your .json Lexicon files. The script will search recursively.
  • <path/to/output-markdown>: The directory where the generated .md files will be saved. It will be created if it doesn't exist.

Linking Behavior

  • Internal References: References within the same document (starting with #, e.g., #main) are linked to the corresponding definition's anchor tag within that document. Anchor names are generated from the definition key (e.g., main).
  • External References: References to other Lexicons (e.g., com.atproto.repo.strongRef) are handled based on the prefixLinkTable in config.ts:
    • If a matching prefix (e.g., com.atproto) has a function defined, that function generates the link URL.
    • If the prefix is null or not found in the table, the reference is displayed as inline code without a link.

Contributing

Found a bug or have a feature request? Feel free to open an issue on the project's repository! Contributions via pull requests are also welcome (please adhere to existing coding style).