1.4.1 • Published 3 years ago

remark-abbr v1.4.1

Weekly downloads
2,064
License
MIT
Repository
github
Last release
3 years ago

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

1.4.1

3 years ago

1.4.0

4 years ago

1.3.5

4 years ago

1.3.3

4 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago