npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

markdown-it-attribution-references

v2.1.0-alpha.3

Published

MarkdownIt Plugin for attributions, attribution references and list

Downloads

7

Readme

markdown-it-attribution-references

Attributions and attribution referencing for markdown-it.

Installation

yarn add markdown-it-attribution-references

or

npm install markdown-it-attribution-references

Example

# Markdown

::: attribution cc-by-sa [Markdown](https://en.wikipedia.org/w/index.php?title=Markdown&oldid=975764292) [Wikipedia Authors](https://en.wikipedia.org/w/index.php?title=Markdown&action=history)

Markdown is a lightweight markup language with plain-text-formatting syntax, created in 2004 by John Gruber with Aaron Swartz.
Markdown is often used for formatting readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.

:::
<h1>Markdown</h1>
<div id="wikipedia-authors-markdown" class="parent">
  <div class="child">
    <p>
      Markdown is a lightweight markup language with plain-text-formatting syntax, created in 2004 by John Gruber with
      Aaron Swartz. Markdown is often used for formatting readme files, for writing messages in online discussion
      forums, and to create rich text using a plain text editor.
    </p>
  </div>
  <p>
    <a href="#wikipedia-authors-markdown" class="anchor">§</a
    ><a href="#wikipedia-authors-markdown" class="label">Attribution 1</a
    ><span
      >Based on: <a href="https://en.wikipedia.org/w/index.php?title=Markdown&amp;oldid=975764292">Markdown</a> by
      <a href="https://en.wikipedia.org/w/index.php?title=Markdown&amp;action=history">Wikipedia Authors</a>, License:
      <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons: Attribution-ShareAlike 4.0</a></span
    >
  </p>
</div>
<h2 id="list-of-attributions" class="list">List of Attributions</h2>
<ol class="list">
  <li class="item">
    <a href="#wikipedia-authors-markdown" class="label">Attribution 1</a>:
    <a href="https://en.wikipedia.org/w/index.php?title=Markdown&amp;oldid=975764292">Markdown</a> (By:
    <a href="https://en.wikipedia.org/w/index.php?title=Markdown&amp;action=history">Wikipedia Authors</a>,
    <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons: Attribution-ShareAlike 4.0</a>
  </li>
</ol>

Usage

const md = require("markdown-it")().use(require("markdown-it-attribution-references"), opts);

See a demo as JSFiddle.

The opts object can contain:

| Name | Description | Default | | ------------- | ----------------------------------------------------- | ---------------- | | after | Rule name to insert new rules after. | false | | ns | Namespace for saving registered attributions (env). | "attributions" | | wrap | Wrapper options. | see below | | anchor | Anchor options. | see below | | label | Label options. | see below | | list | List options. | see below | | attribution | Attribution options. | see below |

The wrap object can contain:

| Name | Description | Default | | -------- | ----------------------- | --------- | | parent | Parent wrapper options. | see below | | child | Child wrapper options. | see below |

The parent object can contain:

| Name | Description | Default | | ------- | --------------------- | ---------- | | tag | HTML tag for parent. | "div" | | class | Parent wrapper class. | "parent" |

The child object can contain:

| Name | Description | Default | | -------- | ------------------------ | --------- | | enable | Wrap attributed content. | true | | tag | HTML tag for child. | "div" | | class | Child wrapper class. | "child" |

The anchor object can contain:

| Name | Description | Default | | --------- | --------------------------------------- | ---------- | | enable | Insert anchor before attribution label. | true | | content | Anchor content. | "§" | | class | Anchor class. | "anchor" |

The label object can contain:

| Name | Description | Default | | ------------- | ----------------------------------------------- | ----------------- | | enable | Insert attribution label before figure caption. | true | | text | Attribution label text. | "Attribution #" | | placeholder | Attribution number placeholder. | "#" | | class | Attribution label class. | "label" |

The list object can contain:

| Name | Description | Default | | -------- | ---------------------------- | ------------------------ | | enable | Append list of attributions. | true | | class | List of attributions class. | "list" | | title | List title. | "List of Attributions" | | tag | HTML tag for list. | "ol" | | item | List item options | see below |

The item object can contain:

| Name | Description | Default | | ------- | --------------------------------- | ------------------------------------- | | tag | HTML tag for list item. | "li" | | href | Add target id to list item label. | true | | class | List item class. | "item" | | label | Insert attribution label. | true | | text | List title pattern. | "<title> (By: <author>, <license>)" |

The attribution object can contain:

| Name | Description | Default | | ------------ | ------------------------------------------------------------- | ----------------------------------------------------- | | top | Insert attribution at top, before child (attributed content). | false | | terminator | Terminator for attribution open/close. | ":::" | | label | Terminator followed by attribution open. | "attribution" | | text | Attribution title pattern. | "Based on: <title> by <author>, License: <license>" | | licenses | Array of license objects. | [ see below ] |

Each license objects can contain:

| Name | Description | Example | | --------- | --------------------------------- | --------------------------------- | | id | Identifier used for attributions. | "cc-by" | | short | Short license name. | "CC BY" | | name | Full license name. | "Creative Commons: Attribution" | | version | License Version. | "4.0" | | url | License related URLs. | { deeds, legalCode } |

An extensive list of possible license agreements can be found at Comparison of free and open-source software licences.

License

GPL-3.0 © StudyATHome Internationally