JSPM

hashbrown

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q35207F
  • License MIT

Extract tags inlined within a Markdown string.

Package Exports

  • hashbrown

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 (hashbrown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Hashbrown.js npm Version Build Status Coverage Status

Extract tags inlined within a Markdown string.

Usage

Hashbrown is an experiment in embedding meta data within running text. It is similar to the concept of the hashtag, only that the post-processed text is syntactically correct. This is because the #( and ) markup used to demarcate a tag is removed from the text.

var str = '#( Lorem ipsum! ) Dolor #( sit ) amet!';

hashbrown(str);
/* =>
 * {
 *   text: '<p>Lorem ipsum! Dolor sit amet!</p>\n',
 *   tags: ['lorem-ipsum', 'sit']
 * }
 */

A tag is converted to kebab-case as follows:

  1. Discard any character that isn’t alphanumeric, whitespace, a dash, or an underscore.
  2. Replace whitespace and underscore characters with a dash.

API

hashbrown(str)

Parses the given Markdown-formatted str, and returns an object containing the processed text, and an array of tags.

Installation

Install via npm:

$ npm i --save hashbrown

License

MIT license