spatialaudio / nbsphinx

:ledger: Sphinx source parser for Jupyter notebooks
https://nbsphinx.readthedocs.io/
MIT License
457 stars 130 forks source link

Figures aligned left after compiling #291

Open robertorolo opened 5 years ago

robertorolo commented 5 years ago

I am using ![conda](images/anaconda.png) to insert a figure on a markdown cell. On the jupyter notebook, when i run the cell, the image shows aligned on center. However when i compile my docs using sphinx (i am using RTD theme) the images aligned on left.

mgeier commented 5 years ago

Currently, nbsphinx uses pandoc to convert Markdown to reStructuredText which is then processed by Sphinx.

The call is comparable to this:

pandoc --from markdown-implicit_figures --to rst

Your input

![conda](images/anaconda.png)

... will be transformed to

|conda|

.. |conda| image:: images/anaconda.png

... which contains no information about alignment. So it's up to Sphinx to choose the alignment.

You may find a Sphinx option to change the default alignment?

Or you can try to use some custom CSS to get your desired alignment.

Or you can try to hack src/nbsphinx.py to do what you want.

If you come up with a satisfactory solution, feel free to make a PR!