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

gulp-md

v0.0.2

Published

Gulp plugin for parse markdown files and convert to html

Downloads

16

Readme

gulp-md

npm version License: MIT TypeScript

Gulp plugin for parsing Markdown files and converting them to sanitized HTML using marked and DOMPurify. Supports both ESM and CommonJS.

Features

  • Markdown to HTML: Uses marked for fast and extensible Markdown parsing.
  • Security by default: Automatically sanitizes HTML output with isomorphic-dompurify to prevent XSS attacks.
  • Stream & Buffer support: Handles both buffer and stream file contents seamlessly.
  • TypeScript ready: Includes full TypeScript definitions.
  • Zero configuration: Works out of the box, but allows custom marked options.
  • Gulp 5 compatible: Built for the latest Gulp ecosystem.

Installation

npm install gulp-md --save-dev
# or
pnpm add -D gulp-md
# or
yarn add -D gulp-md

Quick Start

Create a gulpfile.js (or .mjs / .ts):

import { src, dest } from 'gulp'
import markdown from 'gulp-md'

export function compileMarkdown() {
  return src('src/**/*.md')
    .pipe(markdown())
    .pipe(dest('dist/html'))
}

Run with:

gulp compileMarkdown

API

markdown([options])

Returns a Transform stream that converts .md files to .html.

Parameters

  • options (object, optional) – Configuration object passed to marked.setOptions(). If omitted, default marked options are used.

Returns

  • Transform stream instance.

Examples

Basic usage with Gulp tasks

import { src, dest, series, watch } from 'gulp'
import markdown from 'gulp-md'

function build() {
  return src('docs/*.md')
    .pipe(markdown())
    .pipe(dest('public/docs'))
}

function watchFiles() {
  watch('docs/*.md', build)
}

export { build, watchFiles }
export default series(build, watchFiles)

Custom Markdown options

import markdown from 'gulp-md'

const customOptions = {
  gfm: true,
  breaks: false,
  headerIds: true,
}

function parse() {
  return src('src/*.md')
    .pipe(markdown(customOptions))
    .pipe(dest('out'))
}

Using with template engines (e.g., Twig)

You can combine gulp-md with other Gulp plugins to embed generated HTML into templates.

import markdown from 'gulp-md'
import replace from 'gulp-replace'

function generatePages() {
  return src('src/pages/*.md')
    .pipe(markdown())
    .pipe(replace('{{ content }}', (match) => match)) // example placeholder
    .pipe(dest('dist/pages'))
}

How it works

  1. Reads each .md file from the Gulp stream.
  2. Parses Markdown content into HTML using marked.
  3. Sanitizes the HTML with DOMPurify to remove potentially dangerous elements/attributes.
  4. Changes the file extension to .html and passes it downstream.

Both buffer and streaming modes are supported; the plugin automatically chooses the appropriate processing method.

Project structure

gulp-md/
├── ts/gulp-md.ts          # TypeScript source
├── lib/                   # Compiled output (ESM + CJS)
├── src/                   # Example/documentation sources
├── package.json
├── README.md
└── LICENSE

Development

Clone the repository and install dependencies:

git clone https://github.com/llcawc/gulp-md.git
cd gulp-md
pnpm install

Available scripts:

pnpm run build     # Compile TypeScript to lib/
pnpm run lint      # Run Biome linter
pnpm run fix       # Auto‑fix linting issues
pnpm run check     # Run Biome checks
pnpm run fmt       # Format code with Biome

Acknowledgments

License

MIT License. © 2025 llcawc. Made with ❤️ to beautiful architecture.