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

comark-include

v0.11.0

Published

Include Markdown partials and code snippets from files, by lines or by region, with :include{src="./part.md"}. A Comark plugin.

Readme

comark-include

npm version npm downloads license docs

Include Markdown partials and code snippets from files, with :include{src="./part.md"}. A Comark parse plugin: the included text renders as the rest of the document does, in any renderer.

pnpm add comark comark-include
import { parseMarkdown } from "comark";
import include from "comark-include";

const document = await parseMarkdown(markdown, {
  plugins: [include({ root: "content", base: "guide" })],
});

Each include sits alone on its own line:

:include{src="./parts/pizza-policy.md"}

:include{src="/src/ducks.ts" lines="10:24"}

:include{src="/src/ducks.ts" region="estimate"}

A .md, .mdc, or .markdown file is pasted as Markdown, without its frontmatter, and its own includes resolve from its folder. Any other file becomes a fenced code block in the language of its extension, with a fence longer than any backtick run in the file.

| Argument | | | --- | --- | | src | The file. A relative path starts at the document's folder, or at the including partial's; / starts at root. Required. | | lines | "10:24": lines 10 to 24, 1-based and inclusive. "10:" and ":24" leave one end open. Lines count from the top of the file, frontmatter included, as in an editor, but frontmatter is never pasted. | | region | The lines between #region estimate and #endregion estimate. A marker starts its line, after a comment opener if any: //, #, /*, <!--, --, ;, %, or '. Marker lines are dropped. | | code | Fences a Markdown file instead of pasting it. | | lang | The fence's language, instead of the extension. Fences the file too. |

lines and region are dedented. An include inside fenced code stays as it is, even in a list item or a blockquote, so docs can show the syntax, and pasted lines are indented like the include line, so a partial can sit in a list item.

Options

| Option | | | --- | --- | | root | The folder includes can't leave. Default ".", the working directory. | | base | The document's folder relative to root. Default "". | | read(path) | Reads a file by its POSIX path relative to root and returns its text, or undefined when it doesn't exist. It may be async. The default reads from disk, so pass your own in a browser or an edge runtime. | | depth | How many levels of includes may nest. Default 8. |

../ can't leave root in any runtime, and read only gets paths under it. The default reader also refuses a symlink that leads out of root. A custom read has to refuse those itself.

meta.includes lists every file the document included or tried to include, so a watcher can rebuild when one changes or appears.

Issues

An include that fails is dropped, and the plugin adds a sentence to meta.issues that names it and says how to fix it:

include "./duck-log.md": file not found. It resolved to "guide/duck-log.md" under the root; check the path or base.
include "./pizzas.md": guide/pizzas.md includes itself (guide/pizzas.md -> guide/merged-prs.md -> guide/pizzas.md). Remove one of the includes.

Every kind of problem has a rule in Doctor. A partial that leaves a ::block open is closed at the end of its paste and reported.

Use :include, with one colon: a ::include line would take in the rest of the document. Streaming parses aren't supported.

On GitHub and npm

GitHub and npm show a README's source, and no Comark renderer runs there. For files read there, use automd's file generator, which writes the included text into the file itself. Its arguments share these names: src, lines="a:b", code, and lang.