Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(Style): clarify indentation of documentation strings #596

Open
wants to merge 1 commit into
base: lean4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions templates/contribute/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Every definition and major theorem is required to have a doc string.
or might be useful in another file.)
These are introduced using `/--` and closed by `-/` above the definition, with either newlines or
single spaces between the markers and the text.
Subsequent lines in a doc-string should not be indented.
They can contain Markdown and LaTeX as well: see the next section. If a doc string is a complete
sentence, then it should end in a period. Named theorems, such as the **mean value theorem** should be bold faced (i.e., with
two asterisks before and after).
Expand Down
5 changes: 4 additions & 1 deletion templates/contribute/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ two main concepts in the theory of xyzzyology.
## Main results

- `exists_foo`: the main existence theorem of `foo`s.
- `bar_of_foo`: a construction of a `bar`, given a `foo`.
- `bar_of_foo`: a construction of a `bar`, given a `foo` under very complicated
and intricate circumstances worth describing in excruciating detail.
Copy link
Member

Choose a reason for hiding this comment

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

I don’t understand what this change is doing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change is meant to illustrate an example, where an item spans multiple lines. (I got this wrong previously, by not indenting the second line: this is not how markdown expects items. Hence, I think this is worth clarifying.)

It seems the wording is not clear; I'm very happy to change it. For instance, would this be clearer?

- `bar_of_foo_of_baz`: a construction of a `bar`, given a `foo` and a `baz`. If this doc-string was longer than one
  line, subsequent lines should be indented by two spaces (as required by markdown syntax).

- `bar_eq` : the main classification theorem of `bar`s.

## Notation
Expand Down Expand Up @@ -562,6 +563,8 @@ implementation notes) or for comments in proofs.
Use `--` for short or in-line comments.

Documentation strings for declarations are delimited with `/-- -/`.
When a documentation string for a declaration spans multiple lines, do not indent
subsequent lines.

See our [documentation requirements](doc.html) for more suggestions
and examples.