Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-abbr

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-abbr

This [remark][remark] plugin parses custom Markdown syntax to produce (HTML) abbreviations.

  • 1.4.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
920
increased by3.6%
Maintainers
2
Weekly downloads
 
Created
Source

remark-abbr Build Status Coverage Status

This remark plugin parses custom Markdown syntax to produce (HTML) abbreviations.

It introduces a new MDAST node type: "abbr".

interface abbr <: Node {
  type: "abbr";
  abbr: string;
  reference: string;
  data: {
    hName: "abbr";
    hProperties: {
      title: string;
    }
  }
}

Syntax

Abbreviations are defined a bit like footnotes:

This plugin works on MDAST, a Markdown AST
implemented by [remark](https://github.com/remarkjs/remark)

*[MDAST]: Markdown Abstract Syntax Tree.
*[AST]: Abstract syntax tree

This would compile to the following HTML:

<p>This plugin works on <abbr title="Markdown Abstract Syntax Tree.">MDAST</abbr>, a Markdown <abbr title="Abstract syntax tree">AST</abbr>
implemented by <a href="https://github.com/remarkjs/remark">remark</a></p>

Installation

npm:

npm install remark-abbr

Usage

Dependencies:

const unified = require('unified')
const remarkParse = require('remark-parse')
const remarkAbbr = require('remark-abbr')
const stringify = require('rehype-stringify')
const remark2rehype = require('remark-rehype')

Usage:

unified()
  .use(remarkParse)
  .use(remarkAbbr)
  .use(remark2rehype)
  .use(stringify)

Options

options.expandFirst

Expand the first occurrence of each abbreviation in place to introduce the definition and it's definition. Further occurrences are parsed into "abbr" MDAST nodes as the plugin would normally do.

example

.use(remarkAbbr, { expandFirst: true })

given

This plugin works on MDAST.

More stuff about MDAST.

*[MDAST]: Markdown Abstract Syntax Tree

produces

<p>This plugin works on Markdown Abstract Syntax Tree (<abbr title="Markdown Abstract Syntax Tree">MDAST</abbr>).</p>
<p>More stuff about <abbr title="Markdown Abstract Syntax Tree">MDAST</abbr>.</p>"

License

MIT © Zeste de Savoir

Keywords

FAQs

Package last updated on 27 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc