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

nuxt-markdown-renderer

v0.1.0

Published

Nuxt module to render HTML pages as Markdown by appending .md to URLs

Downloads

5

Readme

nuxt-markdown-renderer

A Nuxt 4 module that converts HTML pages to Markdown by appending .md to any URL.

Features

  • Convert any HTML page to Markdown by adding .md to the URL
  • Powered by Turndown for reliable HTML-to-Markdown conversion
  • Customizable Markdown output options
  • Works with server-side rendering (SSR)
  • Nuxt 4 compatible
  • TypeScript support

Installation

npm install nuxt-markdown-renderer

Usage

Add the module to your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['nuxt-markdown-renderer']
})

Now you can access any page in Markdown format by appending .md to the URL:

http://localhost:3000/about        -> HTML page
http://localhost:3000/about.md     -> Markdown version
http://localhost:3000/blog/post-1  -> HTML page
http://localhost:3000/blog/post-1.md -> Markdown version

Configuration

You can customize the module behavior in your nuxt.config.ts:

export default defineNuxtConfig({
  modules: ['nuxt-markdown-renderer'],

  markdownRenderer: {
    // Enable or disable the module
    enabled: true,

    // Custom suffix (default: '.md')
    suffix: '.md',

    // Turndown options
    turndownOptions: {
      headingStyle: 'atx',        // 'atx' or 'setext'
      hr: '---',
      bulletListMarker: '-',      // '-', '+', or '*'
      codeBlockStyle: 'fenced',   // 'fenced' or 'indented'
      fence: '```',               // '```' or '~~~'
      emDelimiter: '_',           // '_' or '*'
      strongDelimiter: '**',      // '**' or '__'
      linkStyle: 'inlined'        // 'inlined' or 'referenced'
    }
  }
})

Module Options

enabled

  • Type: boolean
  • Default: true

Enable or disable the module.

suffix

  • Type: string
  • Default: '.md'

The URL suffix that triggers Markdown rendering.

turndownOptions

  • Type: object
  • Default: See configuration example above

Options passed to Turndown for customizing the Markdown output.

Examples

Basic Example

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-markdown-renderer']
})

Visit http://localhost:3000/index.md to see your homepage in Markdown format.

Custom Suffix

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-markdown-renderer'],

  markdownRenderer: {
    suffix: '.markdown'
  }
})

Now use http://localhost:3000/index.markdown instead.

Customize Markdown Style

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-markdown-renderer'],

  markdownRenderer: {
    turndownOptions: {
      headingStyle: 'setext',
      bulletListMarker: '*',
      codeBlockStyle: 'indented'
    }
  }
})

Output Format

The generated Markdown includes frontmatter with metadata:

---
source: http://localhost:3000/about
generated: 2025-01-15T12:00:00.000Z
---

# About Us

This is the about page content...

How It Works

  1. User requests a URL ending with .md (e.g., /about.md)
  2. The module intercepts the request
  3. Fetches the original HTML page (e.g., /about)
  4. Converts the HTML to Markdown using Turndown
  5. Returns the Markdown with appropriate headers

Use Cases

  • Export documentation pages as Markdown
  • Create Markdown backups of your content
  • Enable easy content migration
  • Provide alternative content format for API clients
  • Debug and inspect rendered HTML structure

Development

# Install dependencies
npm install

# Build the module
npm run prepack

# Run development server (if you have a playground)
npm run dev

# Run tests
npm run test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Credits

Built with: