markdown-it-fontawesome
Version:
Markdown-it plugin that adds Font Awesome 5 icons support
91 lines (56 loc) • 1.61 kB
Markdown
# markdown-it-fontawesome
[Markdown-it][markdown-it] plugin that adds [Font Awesome][fontawesome] icons support.
Turn this:
```md
Hello World! :fa-flag:
```
Into this:
```html
<p>Hello World! <i class="fa fa-flag"></i></p>
```
## Install
```bash
$ npm install markdown-it-fontawesome --save
```
## Usage
### Enable plugin
```js
var md = require('markdown-it');
var fa = require('markdown-it-fontawesome');
md().use(fa);
```
### Font Awesome version 4 example
```md
Hello World! :fa-flag:
- [:fa-google: Google](https://www.google.com/)
- [:fa-github: GitHub](https://github.com/)
```
Gets converted to:
```html
<p>Hello World! <i class="fa fa-flag"></i></p>
<ul>
<li><a href="https://www.google.com/"><i class="fa fa-google"></i> Google</a></li>
<li><a href="https://github.com/"><i class="fa fa-github"></i> GitHub</a></li>
</ul>
```
### Font Awesome 5+ example
```md
Hello World! :fal-flag:
- [:fab-google: Google](https://www.google.com/)
- [:fab-github: GitHub](https://github.com/)
```
gets converted to:
```html
<p>Hello World! <i class="fal fa-flag"></i></p>
<ul>
<li><a href="https://www.google.com/"><i class="fab fa-google"></i> Google</a></li>
<li><a href="https://github.com/"><i class="fab fa-github"></i> GitHub</a></li>
</ul>
```
[markdown-it]: https://github.com/markdown-it/markdown-it
[fontawesome]: https://fortawesome.github.io/Font-Awesome/
### Credits
Original: https://github.com/nunof07
Font awesome 5 support and tests: https://github.com/rjjakes
### License
MIT