remark-hreflang
Version:
This remark plugin parses custom Markdown syntax to provides hreflang attributes on links.
60 lines (41 loc) • 1.15 kB
Markdown
This [remark](https://github.com/remarkjs/remark) plugin parses custom Markdown syntax to provides `hreflang` attributes on links.
`hreflang` attributes is used to define the lang of the targeted content.
To use it, you have to declare the lang in parentheses at the end of your link label:
```markdown
I use this plugin on [my own website (fr)](https://tzi.fr), because I mix several languages on it!
```
This would compile to the following HTML:
```html
<p>I use this plugin on <a href="https://tzi.fr" hreflang="fr">my own website</a>, because I mix several languages on it!</p>
```
via npm:
```bash
npm install remark-hreflang --save
```
JavaScript usage:
```javascript
var remark = require("remark");
var hreflang = require("remark-hreflang");
remark()
.use(hreflang)
.process(html, function(error) {
console.error(error);
});
```
MIT. Copyright (c) [Thomas Zilliox](https://tzi.fr).
```bash
npm ci
npm test
npm run formart
npm run build
```