Skip to content

Conversation

@pimotte
Copy link
Contributor

@pimotte pimotte commented Jun 9, 2025

This feature is controlled by the verso.literateMarkdown.convertDoccomments option, which defaults to false for backwards compatibility.

@david-christiansen david-christiansen changed the title feat: Convert docComments in Literate Lean pages feat: convert docComments in Literate Lean pages Jun 10, 2025
addBlock (← ofBlock helper other)
-- Lemma is purposefully unchecked, such that it can be matched on when a project
-- is dependent on mathlib
| ``declaration | `lemma =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is making me think that this should be an attribute rather than a hardcoded list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we can attach an attribute to the keyword lemma somehow (or can we avoid tagging every lemma in the book project)? If yes, I definitely agree.

If not, I think it depends on the aim of LiterateLeanPage:

  • If the goal is to best-effort render any existing lean file, then having to tag the custom-definitions you want to be converted is kind of rough.
  • If the goal is to provide an easy way to convert an existing lean file to something that can be rendered nicely, then I think introducing an attribute is fine.

I can totally get it if you don't want to have the hardcoded `lemma there in any case, so I'm also happy to remove it and maintain it as a patch right now for the analysis book project, since I'm currently doing that anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that there would be something like an attribute that's attached to the syntax kind lemma, not to every lemma in the world! So you'd have something along the lines of:

attribute [renderDocComments] Mathlib.Parser.Declarations.lemma

once in your setup file.

Do you know how to make an environment extension and a custom attribute? If not, I can do that last step before merging.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it's not so much that I want to avoid the hardcoded lemma as it is that I want other people to be able to use this with their own custom syntax without having to send me patches!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants