pypa / readme_renderer

Safely render long_description/README files in Warehouse
Apache License 2.0
158 stars 88 forks source link

Recent upgrade of docutils seems to have broken formatting of RestructuredText descriptions #264

Closed schlatterbeck closed 1 year ago

schlatterbeck commented 1 year ago

Description Included graphics now have an un-rendered <figure class="align-center"> start tag and end tag </figure> For an example see https://pypi.org/project/plot-antenna/1.0/ This worked previously for the same ReST.

When including citation references, the citation at the end now has a newline after the citation mark and no hanging indent is used. An example is also under the link above.

Note for my Nikola Blog (also ReST based) I had to include the following CSS for correctly formatting citations:

aside.footnote p {
    display: inline;
}

aside.footnote {
    padding-left: 2em;
    text-indent: -2em;
}

Expected behavior Github displays the same ReST fine: https://github.com/schlatterbeck/plot-antenna

To Reproduce See https://pypi.org/project/plot-antenna/1.0/ source of is the README for https://github.com/schlatterbeck/plot-antenna

My Platform Firefox browser on Debian Bullseye

miketheman commented 1 year ago

@schlatterbeck Thanks for the report - you mention citation references, but there are none in the example RST file you referenced.

schlatterbeck commented 1 year ago

@miketheman : You claim that there are no citation refs in the RST file at: https://pypi.org/project/plot-antenna/1.0/

When you scroll to the end you see something like

[2]

L. B. Cebik. Antenna Modeling Notes, volume 2. antenneX Online Magazine, 2003. Available with antenna models from the [Cebik collection](http://on5au.be/Books/allmodnotes.zip).

I would call that a citation reference, maybe I'm using the wrong terminology. The formatting should be something like

[2] L. B. Cebik. Antenna Modeling Notes, volume 2. antenneX Online Magazine, 2003. Available with antenna models from the
     [Cebik collection](http://on5au.be/Books/allmodnotes.zip).

The cited css snipped does that for me in my nikola blog.

Can we re-open this issue? Seems I cannot. Or should I open a separate issue?

miketheman commented 1 year ago

@schlatterbeck thanks for clarifying - docutils calls those footnotes, not citations - very similar, but different in their HTML counterparts and rendering - hence the confusion.

I've added a new pull request that confirms both footnotes and citations behavior, which confirms there's no further code change necessary on the library side.

For the visualization aspect, we may need some CSS tweaks on the warehouse side for display.

schlatterbeck commented 1 year ago

@miketheman thanks for the followup, I wasn't aware that the numerical and non-numerical footnotes are different beasts. Should we open a new issue on warehouse and/or resurrect the original issue there? Or are you taking care of this?

Thanks Ralf

miketheman commented 1 year ago

Let's let the updated version hit warehouse first, confirm that the figure works first.

schlatterbeck commented 1 year ago

@miketheman : Seems your changes are in warehouse, the figure bug is gone from my project: https://pypi.org/project/plot-antenna/1.0/

But the footnote formatting is still broken. Let me know what to do: Open a new issue on warehouse? Resurrect the old issue and note that the figure part is fixed?

The fix as already reported involves a slight change to the CSS.

miketheman commented 1 year ago

@schlatterbeck Thanks for the ping - I've added the correction in a PR to warehouse - follow that one for resolution!