Skip to content

Instantly share code, notes, and snippets.

Created Aug 22, 2014
What would you like to do?
sys.path.insert(0, '.')
Use font awesome using `:awesome:` role.
:awesome:`fa-home` fa-home
:awesome:`fa-home fa-fw` fa-home fa-fw
# Author: @tk0miya
# License: Apache 2.0
from docutils import nodes, utils
def awesome_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
awesome_tag = '<i class="fa %s"></i>' % utils.unescape(text)
raw = nodes.raw('', awesome_tag, format='html')
return [raw], []
def setup(app):
app.add_role('awesome', awesome_role)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment