Title: change: Collect and concat footnotes/references when rendering sections or partial docstrings · Issue #217 · mkdocstrings/python · GitHub
Open Graph Title: change: Collect and concat footnotes/references when rendering sections or partial docstrings · Issue #217 · mkdocstrings/python
X Title: change: Collect and concat footnotes/references when rendering sections or partial docstrings · Issue #217 · mkdocstrings/python
Description: Is your change request related to a problem? Please describe. Context: Python-Markdown/markdown#1495. If a docstring's first line uses a reference, and that reference is declared in the body, then current summary features will not be abl...
Open Graph Description: Is your change request related to a problem? Please describe. Context: Python-Markdown/markdown#1495. If a docstring's first line uses a reference, and that reference is declared in the body, then ...
X Description: Is your change request related to a problem? Please describe. Context: Python-Markdown/markdown#1495. If a docstring's first line uses a reference, and that reference is declared in the body, t...
Opengraph URL: https://github.com/mkdocstrings/python/issues/217
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"change: Collect and concat footnotes/references when rendering sections or partial docstrings","articleBody":"### Is your change request related to a problem? Please describe.\r\nContext: https://github.com/Python-Markdown/markdown/issues/1495.\r\n\r\nIf a docstring's first line uses a reference, and that reference is declared in the body, then current summary features will not be able to render the reference.\r\n\r\n### Describe the solution you'd like\r\nThe only way to be more robust is to actually render a concatenation of all text sections found in the docstring, to then retrieve the first HTML paragraph.\r\n\r\n- Concatenation: `\"\\n\\n\".join(section.value for section in sections if section.kind is DocstringSectionKind.text)`\r\n- Retrieval of first paragraph: use standard lib's HTML parser, feed the result to it, record only first `p` element and break\r\n\r\n### Describe alternatives you've considered\r\nDocumenting this as a limitation. Afterall, there are clear semantics for Python docstrings, where the *summary* is the *first line* only, separated from the body by a blank line. If the first line depends on the body to be rendered correctly, we could consider it a user error.\r\n\r\nAnother alternative would be to parse the docstring as Markdown (just *parse*, not convert) to collect references and footnotes (any other similar item?), to append them back to any summary or text section when rendering.\r\n\r\n### Additional context\r\nI thought about doing this (first suggestion) for text sections too, when rendering them. However, if we concatenate from the current section down to the last, I don't think it's possible to robustly retrieve *just* the content of the current section from the resulting HTML. The \"collect refs to append back\" suggestion would work, though.","author":{"url":"https://github.com/pawamoy","@type":"Person","name":"pawamoy"},"datePublished":"2024-12-13T17:34:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/217/python/issues/217"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:47784277-7aee-1bca-032c-caa325c9a07b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E1E6:1494FD:7C10E7:A82869:6973C166 |
| html-safe-nonce | ab0ae1c668276c57fc4c5530f27025d0dbf0af4600055b43f91e39e153d2929b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUU2OjE0OTRGRDo3QzEwRTc6QTgyODY5OjY5NzNDMTY2IiwidmlzaXRvcl9pZCI6IjY1MzEzNTIyNTA0OTA3OTg0MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0d302cafa340c2620593ffca26bbd73683c3c5d85740aa386a139a4cf24553c7 |
| hovercard-subject-tag | issue:2738880030 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/mkdocstrings/python/217/issue_layout |
| twitter:image | https://opengraph.githubassets.com/abe4fd4332cd98d63eadcba52919279a32e01f96aea2fbc188c66762900b97b8/mkdocstrings/python/issues/217 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/abe4fd4332cd98d63eadcba52919279a32e01f96aea2fbc188c66762900b97b8/mkdocstrings/python/issues/217 |
| og:image:alt | Is your change request related to a problem? Please describe. Context: Python-Markdown/markdown#1495. If a docstring's first line uses a reference, and that reference is declared in the body, then ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pawamoy |
| hostname | github.com |
| expected-hostname | github.com |
| None | acb8c988baca9616cb18bcb596629b823688faa1ef21a000061fe3616b4e3605 |
| turbo-cache-control | no-preview |
| go-import | github.com/mkdocstrings/python git https://github.com/mkdocstrings/python.git |
| octolytics-dimension-user_id | 75664361 |
| octolytics-dimension-user_login | mkdocstrings |
| octolytics-dimension-repository_id | 422878404 |
| octolytics-dimension-repository_nwo | mkdocstrings/python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 422878404 |
| octolytics-dimension-repository_network_root_nwo | mkdocstrings/python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | af4eb23c75c70abd61c0b216b767faf4c9a30817 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width