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:a463ecba-cda4-b2cf-e741-5d2737362c82 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B6DE:99B47:4FD44FA:678C1E7:69756BF3 |
| html-safe-nonce | e6cd9992867ac56d513f1c881aee93949f2fe3b0a52e32210264482db12db5c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkRFOjk5QjQ3OjRGRDQ0RkE6Njc4QzFFNzo2OTc1NkJGMyIsInZpc2l0b3JfaWQiOiI5MDE1MDYxMTgxMjYwNzIxMTM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b41d4547860ce7610673d9083f7fc344821c5faf3b84ea78a9bd8d8f762aa064 |
| 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 | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| 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 | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width