Skip to content

feat: extensible Markdown rendering of Verso docstrings#14115

Draft
david-christiansen wants to merge 1 commit into
leanprover:masterfrom
david-christiansen:custom-md
Draft

feat: extensible Markdown rendering of Verso docstrings#14115
david-christiansen wants to merge 1 commit into
leanprover:masterfrom
david-christiansen:custom-md

Conversation

@david-christiansen

Copy link
Copy Markdown
Contributor

This PR adds support for extensible Markdown rendering of Verso docstrings.

Markdown rendering is used when docstrings are prepared for LSP hovers as well as for legacy clients that don't directly support Verso. Previously, when the docstring contained a custom element, Markdown rendering simply delegated to the alternate fallback rendering. Now, the custom elements can have custom rendering to Markdown.

Example use cases include:

  • Including a docstring in another: with the module system, docstrings are part of the server olean and are loaded only in interactive sessions. If one docstring is to include another, it must be fetched at a time when the docstrings are loaded and available. A custom element can save which docstring is to be included at elaboration time, and then look it up at rendering time.

  • Showing a list of all currently-available instances of a class.

  • Showing names with respect to the currently-open namespaces.

  • Custom links to e.g. library notes that look up the destination in an environment extension.

This PR adds support for extensible Markdown rendering of Verso
docstrings.

Markdown rendering is used when docstrings are prepared for LSP hovers
as well as for legacy clients that don't directly support
Verso. Previously, when the docstring contained a custom element,
Markdown rendering simply delegated to the alternate fallback
rendering. Now, the custom elements can have custom rendering to
Markdown.

Example use cases include:

* Including a docstring in another: with the module system, docstrings
are part of the server olean and are loaded only in interactive
sessions. If one docstring is to include another, it must be fetched
at a time when the docstrings are loaded and available. A custom
element can save which docstring is to be included at elaboration
time, and then look it up at rendering time.

* Showing a list of all currently-available instances of a class.

* Showing names with respect to the currently-open namespaces.

* Custom links to e.g. library notes that look up the destination in
an environment extension.
@david-christiansen david-christiansen added changelog-language Language features and metaprograms changelog-server Language server, widgets, and IDE extensions labels Jun 18, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 18, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 7821657e0630f8e0dd487658de0459202fd55670 --onto 4792cd22887c8b529a351f6563b693426ff2a8f8. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-18 22:36:36)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 7821657e0630f8e0dd487658de0459202fd55670 --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-06-18 22:36:38)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms changelog-server Language server, widgets, and IDE extensions toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants