literate: no way to hide `@[expose] public section`, `@[reducible] def ...`, or a command after a comment
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- documentation
Research direction
Start in src/verso-literate-code/VersoLiterateCode.lean at leadingKeywords (lines 539–553), then trace how hide_commands matches command text. Reproduce the three cases from the issue and inspect the literate build or related tests. Done means attributes and comments no longer prevent matching the specified commands, with existing plain-command hiding still working.
Written by the indexing model from the issue text.
Description
In a literate site, hide_commands can't hide a command that starts with an attribute, or one with a comment directly above it. Some common cases:
@[expose] public sectionis boilerplate at the top of many module-system files, and readers don't need to see it. But nohide_commandspattern hides it: neither"public section"nor"section"matches.- Declarations with attributes, such as
@[reducible] def foo ...or@[simp] theorem bar ..., aren't hidden by"def"or"theorem", even though the same patterns hide the plaindefandtheoremcommands. - Commands with a comment above them: a
--comment directly above an otherwise matching command, such as adefor anopen, stops it from being hidden.
Reproduction
literate.toml:
hide_commands = ["def", "public section"]
A module in the published library:
module
@[expose] public section
@[reducible] def foo : Nat := 1
def bar : Nat := 2
-- a comment
def baz : Nat := 3
After lake build :literateHtml, only bar is hidden: @[expose] public section, foo and baz all still appear.
Cause
hide_commands matches a command's leading keywords, and leadingKeywords stops at the first token that isn't a keyword:
A comment directly above a command is part of that command's code, so for all three cases the first token is @[ or --, and there are no leading keywords for any pattern to match.
Perhaps the intent is that this feature is only used to hide custom commands?
- Dominant language
- Lean
- Stars
- 420
- Forks
- 134
- Avg merge
- 1d 9m
- Merged PRs (30d)
- 46
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from leanprover/verso
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
leanprover/verso#972 ·
Maintainers usually reply within 1 day
-
`"&"` in docstring of `Html.text` is not rendered literallyMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 82/100
leanprover/verso#898 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
leanprover/verso#1133 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
leanprover/verso#1125 ·
Maintainers usually reply within 1 day
-
`ptrEqThen`'s compiled implementation disagrees with its definition when `beq` is not reflexiveOpen
Difficulty 4/5 3-5 days Newbie friendliness 35/100
leanprover/verso#1095 ·
Maintainers usually reply within 1 day
All issues in leanprover/verso
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
優先度たかし
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
lean-ja/lean-by-example#2681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
laststance/design-world#79 ·
Maintainers usually reply within 1 day
-
v2
Difficulty 1/5 Under an hour Newbie friendliness 86/100
modelcontextprotocol/python-sdk#3978 · 2 comments ·
Maintainers usually reply within 1 day