@tinyhttp/markdown

npm (scoped) npm

tinyhttp static markdown middleware Based on marked (markdown library) and @tinyhttp/static. Useful for creating simple static Markdown sites with basic routing. Used by tinyhttp website.

Install

pnpm i @tinyhttp/static

API

markdownStaticHandler(dir, options)

Handles static files and transforms markdown in HTML in a specified directory. It tries to assign root to README.md or index.md (and with .markdown extension too) in case any of them exists.

Options

Example

import { App } from '@tinyhttp/app'
import { markdownStaticHandler as md } from '@tinyhttp/markdown'

const app = new App()

app.use(
  md('docs', {
    prefix: '/docs',
    stripExtension: true,
    markedExtensions: [
      {
        headerIds: true,
      },
    ],
  })
)

app.listen(3000)

License

MIT © v1rtl

Install

pnpm i @tinyhttp/markdown

Version

0.1.55

Source

packages/static