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

@jcohonner/mdwritertools

v0.3.1

Published

Markdown Writer Tools is a set of tools to write doc in MarkDown and allow easy copy/paste to Google Docs

Readme

Markdown Writer Tools

Markdown Writer Tools helps you compose large Markdown documents from smaller snippets.
It understands custom directives so you can include files, reuse sections, and substitute variables before exporting the final result or rewriting the source in place.

Features

  • {!include(...)!} directives with optional section filtering and heading level adjustment.
  • Variables defined in YAML front‑matter (including lists) and referenced with {!var(name)!} inside included files.
  • Conditional blocks with {!if name=value!} ... {!elseif name=value!} ... {!else!} ... {!endif!} resolved using the entry document variables.
  • CLI commands to export to a new file or run a destructive build that replaces the source.
  • Optional --stripheaders flag to remove the leading front‑matter like block from the final output.
  • Optional --stripcomments flag to remove HTML comment blocks outside fenced code blocks.
  • Optional --img2b64 flag to convert local image references to base64 data URIs automatically so exported Markdown stays self-contained.

Installation

  • Local development: npm link
  • Global install: npm install -g @jcohonner/mdwritertools

Once linked or installed, the CLI is available as mdwt.

Usage

Export

mdwt export path/to/doc.md -o dist/output.md [--stripheaders] [--stripcomments] [--img2b64]

Reads the entry Markdown file, resolves includes and variables, and writes the result to the specified output (stdout if omitted).

Export to clipboard

mdwt export path/to/doc.md -o clipboard [--stripheaders] [--stripcomments] [--img2b64]

Reads the entry Markdown file, resolves includes and variables, and copies the result to the system clipboard.

Build (in-place)

mdwt build path/to/doc.md [--stripheaders] [--stripcomments] [--img2b64]

Resolves directives and writes the rendered content back to the same file. Useful when you need the source file without include directives.

Directive Reference

Include

{!include(relative/or/absolute/path.md|# Section Heading|###)}
  • Only the path is required.
  • Provide a Section Heading that matches a Markdown heading to include just that section.
  • Optionally set a target heading level (e.g., ###) to rebase heading levels in the snippet.
  • You can insert variables into the path using <varName> placeholders that resolve against the upper variable values (after all includes are processed):
{!include(includes/product-<edition>.md)!}

Variables

Define variables in YAML front-matter like block:

---
product: MDWriterTools
---

Lists are supported too:

---
tags:
  - alpha
  - beta
---

Use in content with {!var(product)!}. Variables cascade through includes, so definitions in a parent file are available in children. When a variable is a list, items from included files are merged into the parent list (deduplicated).

Conditionals

Wrap sections that should only appear when an upper variable value matches a value:

{!if edition=pro!}
## Pro content
{!elseif edition=community!}
## Community content
{!else!}
## Default content
{!endif!}
  • Conditions are evaluated when a file is included.
  • The value from the top-level entry document is always used, even if a nested include defines its own variable with the same name.
  • When a variable is a list, {!if name=value!} checks whether the list contains value.
  • Use alongside includes to ship a single source file that produces different outputs depending on the entry variables.

Lists

  • Add an item anywhere with a block that is removed from the final output:
{!list-add backlog
name: Item name
description: ...
status: ...
priority: ...
!}
  • Render a table anywhere with the attributes and labels you need, and an optional path back to the section where the item was captured:
{!list-table(list=backlog|columns=name:Item,status,priority,path:Location)!}
  • list defaults to items when omitted.
  • columns is a comma-separated list of field[:Label]. Include path to add a breadcrumb that links to the heading anchor where the item was added.
  • Headings are tracked across the whole document (after includes) so path links jump to the right section.

Examples and tests

  • Sample documents demonstrating includes, variables, and conditionals live in examples/conditionals.
  • Run npm test to render those examples and assert that conditional blocks respect the entry-level variables.

Development

  1. Clone the repo and run npm install.
  2. Link the CLI locally with npm link.
  3. Run mdwt export ... or mdwt build ... while editing your docs.

Feel free to adapt the CLI to add new directives or automation that fits your documentation workflow.