Search code examples
pythonrestructuredtextpypi

README.rst fails to render on PyPi when using `raw` directive


I have a README.rst in my project hosted on GitHub. It renders fine on GitHub but fails to render on PyPi i.e. I see raw content on the PyPi project description page.

I have looked through similar questions and checked the rst format using python setup.py -r and the packages rstcheck & collective.checkdocs, all of which do not throw any errors. There are no relative links or internal links. I am not sure what the problem is here and how I can fix this.

I know this question has been asked many times. I think I have tried all the solutions and they did not work for me and that is why I am asking again.


Solution

  • See my answer at How to ensure that README.rst is valid?

    python setup.py check -r -s
    running check
    warning: Check: :11: (WARNING/2) "raw" directive disabled.
    
    warning: Check: Invalid markup which will not be rendered on PyPI.
    
    error: Please correct your package.
    

    To fix, don't use the raw directive, and instead use image directive with its various attributes:

    .. image:: https://plot.ly/~aishpant/1.png?share_key=8mG4JmyySLLYjbjTg7Uy62
       :target: https://plot.ly/~aishpant/1/?share_key=8mG4JmyySLLYjbjTg7Uy62
       :align: center
       :alt: sysfs line plot
       :width: 600px