Goin
Goin

Reputation: 3974

Embedding HTML in restructured text on PyPi package pages

In Sphinx I know that you can do it:

.. raw:: html

    <div style="margin-top:10px;">
      <iframe width="560" height="315" src="http://www.youtube.com/embed/_EjisXtMy_Y" frameborder="0" allowfullscreen></iframe>
    </div>

In pypi, is there some way to do it?

How about a youtube video?

Upvotes: 13

Views: 5633

Answers (3)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83706

Restructured text specification is here:

http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html

I believe pypi uses a package called docutils to render the pages.

http://pypi.python.org/pypi/docutils/

raw directive should be supported, in theory, unless specifically disabled.

However, there might be many kind of issues why arbitary HTML is not wanted on PyPi: it would be potential XSS security hole allowing you to capture PyPi credentials from other users.

You can confirm this from PyPi source code: http://wiki.python.org/moin/CheeseShopDev

Upvotes: 1

Drahkar
Drahkar

Reputation: 1671

The point of PyPI is a module package index for quick reference and access to Python modules and packages. It isn't intended to be a customizable media site. You can add a fair amount of information to the index page for your modules and packages you put onto it, but it isn't intended for anything more than an index site.

If you want to have more detailed documentation with a more customized feel, use http://packages.python.org which you can lupload content to through the package edit page: http://pypi.python.org/pypi?%3Aaction=pkg_edit&name=YOURPACKAGE where YOURPACKAGE is the name of the packaged you uploaded to PyPI.

Upvotes: 6

lgs
lgs

Reputation: 141

I don't think you can embbed random html on pypi and I'm glad you can't. Pypi should remain a Python Package Index, not a geocities clone.

If you really need to put a Youtube video on your package page you can put an image with a link to the Youtube video using standard restructured text:

.. image:: http://example.com/image-with-the-first-frame.png
   :target: http://www.youtube.com/your-video

Upvotes: 7

Related Questions