remarkable-seo

Remarkable plugin adds `title` attribute on URL and image tags and `download` attribute on URL if `title` set to `download`.

Usage no npm install needed!

<script type="module">
  import remarkableSeo from 'https://cdn.skypack.dev/remarkable-seo';
</script>

README

remarkable-seo

NPM version Downloads Build Status AppVeyor Build Status

Remarkable plugin adds title attribute on URL and image tags and download attribute on URL if title set to download.

Install

Via npm

npm install remarkable-seo --save-dev

Via Yarn

yarn add remarkable-seo --dev

Usage

import { Remarkable } from 'remarkable';
import remarkableSeo from 'remarkable-seo';

const md = new Remarkable();

const testString = `Add 'title' attribute on link and image where missing.

Links to test Title:

* [Example](http://example.com)
* [Google](https://google.com)
* [Facebook](https://facebook.com "Facebook page")

Attached images:

1. ![Minion](https://octodex.github.com/images/minion.png)
1. ![Manufacturetocat](https://octodex.github.com/images/manufacturetocat.png)
1. ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")
`;

md.use(remarkableSeo);
console.log(md.render(testString));

With CommonJS

const { Remarkable } = require('remarkable');
const remarkableSeo = require('remarkable-seo');
const md = new Remarkable();

const testString = `Add 'title' attribute on link and image where missing.

Links to test Title:

* [Example](http://example.com)
* [Google](https://google.com)
* [Facebook](https://facebook.com "Facebook page")
* [Download Minion](https://octodex.github.com/images/minion.png "download")

Attached images:

1. ![Minion](https://octodex.github.com/images/minion.png)
1. ![Manufacturetocat](https://octodex.github.com/images/manufacturetocat.png)
1. ![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")
`;

md.use(remarkableSeo);
console.log(md.render(testString));

With Docusaurus v1

const remarkableSeo = require('remarkable-seo');
const siteConfig = {
  ...

  markdownPlugins: [
    function (md) {
      remarkableSeo(md);
    }
  ]

  ...
}