sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.57k stars 2.12k forks source link

Use Paymentfont.io icons with ReadTheDocs Theme with Sphinx #2274

Closed brianjking closed 8 years ago

brianjking commented 8 years ago

Hello,

I'm using Sphinx with the ReadTheDocs Theme and building/hosting on readthedocs.org. I'm wondering how I can implement icons from https://github.com/vendocrat/PaymentFont in my Sphinx docs?

As per http://paymentfont.io/#icons I just simply enter <span class="pf pf-paypal"></span> as long as I've uploaded the css and font folders into my site. However, I'm not sure what modifications I need to make to conf.py or any other files to make this work properly.

Thanks!

shimizukawa commented 8 years ago

Please try

  1. locate css and fonts directories under _static directory of your sphinx project.
  2. append this snippet to your conf.py
def setup(app):
    app.add_stylesheet('css/paymentfont.css')

Now you can use several way to use icons like:

Raw block
---------

.. raw:: html

   <span class="pf pf-paypal"></span>

Container
---------

.. container:: pf pf-paypal

   ha!

Custom Role
-----------

.. role:: paypal
   :class: pf pf-paypal

Hello :paypal:`.` World!

Subustition
-----------

.. |paypal| raw:: html

   <span class="pf pf-paypal"></span>

Hello |paypal| World!
brianjking commented 8 years ago

@shimizukawa This works if I execute make html locally, however, the icons do not show when using readthedocs.org.

Any tips there?

Thanks!

brianjking commented 8 years ago

@shimizukawa Sorry, I'm an idiot. I just missed pushing the commit to the remote repository for the addition of the css & font folders inside of _static.

This works great, thank you!

shimizukawa commented 8 years ago

Good to know!