Skip to content

Add title attribute on URL and image tags for better SEO. Also, add download attribute on URL when title set to download and replaced with the URL text.

License

Notifications You must be signed in to change notification settings

trunkcode/remarkable-seo

Repository files navigation

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);
    }
  ]

  ...
}

About

Add title attribute on URL and image tags for better SEO. Also, add download attribute on URL when title set to download and replaced with the URL text.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published