The Font Awesome plugin for Grav allows you to use Font Awesome icons inline with markdown by wrapping the icon name in colons (Github/Slack "emoji style"):
The plugin works by looking for colon-wrapped icon names starting with the :fa-
prefix and converting them to <i>
tags.
This plugin doesn't contain the actual Font Awesome fonts, so make sure you are using a plugin or theme (such as Learn2 or Antimatter) that include the Font Awesome assets.
Also, Markdown Extra must be disabled.
Download zip version of this repository, unzip to /your/site/grav/user/plugins
and rename directory to markdown-fontawesome
.
The markdown-fontawesome.yaml file contains only one configuration which turns the plugin on/off.
enabled: true
Grab a cup of :fa-coffee: and write some :fa-code:
Will produce the following HTML:
Grab a cup of <i class="fa fa-coffee"></i> and write some <i class="fa fa-code"></i>
- Does not work with Markdown Extra enabled (conflicts with definition lists which start with a colon)
- Icon names are not validated, so html tags are created even for non-existent icons like `:fa-not-a-real-icon:``
- Additional fa classes such as
fa-spin
andfa-2x
not yet supported.
If you prefer shortcode syntax [fa=cog /]
, consider using the Grav Shortcode Plugin which also supports Font Awesome.
MIT license. See LICENSE
This plugin was inspired by the python markdown extension fontawesome-markdown and the first version was based on code from the Grav Markdown Color Plugin.