JSPM

markdown-title

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10566
  • Score
    100M100P100Q127023F
  • License MIT

Parse title from Markdown content

Package Exports

  • markdown-title

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (markdown-title) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

markdown-title Build Status

Parses title from Markdown-formatted text

Install

$ npm install markdown-title

Usage

const markdownTitle = require('markdown-title')

let markdown = `
# Title
`

let title = markdownTitle(markdown) //=> Title

The first H1-level title that is found in your Markdown document will be returned, regardless of its position. Supports pound-style headers, not underlined headers (see original Markdown docs). The reason is that I haven’t ever found an underlined header in the wild, and it’s much harder to parse:

This works:

# Title

This, too:

#     I can title? #

This doesn’t:

Title
=====

License

MIT © Anne Fortuin