Created
August 22, 2014 10:52
-
-
Save tk0miya/8558c915187442a0f7dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sys.path.insert(0, '.') | |
extensions.append('sphinxcontrib_awesome') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use font awesome using `:awesome:` role. | |
example:: | |
:awesome:`fa-home` fa-home | |
:awesome:`fa-home fa-fw` fa-home fa-fw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# sphinxcontrib_awesome.py | |
# | |
# 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) | |
app.add_stylesheet('http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment