Zulip Chat Archive

Stream: mathlib4

Topic: Broken reference


Violeta Hernández (Aug 14 2024 at 01:05):

Randomly noticed the first reference here is broken
https://leanprover-community.github.io/mathlib4_docs/Mathlib/Algebra/Jordan/Basic.html

Violeta Hernández (Aug 14 2024 at 01:05):

Is there a way to fix it without exceeding the 100 character per line limit?

Damiano Testa (Aug 14 2024 at 02:49):

There is an analogous issue in exactly one other place in mathlib that you can find by grepping set_option linter.longLine false in (untested).

Damiano Testa (Aug 14 2024 at 02:50):

Basically, you segment the doc-module string and silence the syntax linter by setting the option.

Damiano Testa (Aug 14 2024 at 02:51):

Then you add an exception to the text-based linter.

Damiano Testa (Aug 14 2024 at 02:51):

I wanted to remove the need for the second silencing, but have not gotten around to it.

Damiano Testa (Aug 14 2024 at 02:51):

(On mobile, sorry for the terse instructions.)

Damiano Testa (Aug 14 2024 at 03:04):

Also, I'm not too happy about long references having to be "fixed" like this, but I could not find a better way of automatically excluding them from the linter.

Damiano Testa (Aug 14 2024 at 03:05):

URLs are excluded by automatically ignoring lines containing http as a substring, but these [...][...] references are trickier.

Violeta Hernández (Aug 14 2024 at 03:19):

It'd be nice if there were a mechanism for dealing with this within the Markdown itself. Maybe a line could have a trailing \ to signal that whitespace/newlines immediately following it should be ignored?

Violeta Hernández (Aug 14 2024 at 03:19):

/-- This is a veeeeeeeeee\
  eeeeery long word! -/

Damiano Testa (Aug 14 2024 at 03:21):

Would the reference survive that, though?

Violeta Hernández (Aug 14 2024 at 03:21):

This would be a very early step in parsing, so it should treat it as if it were just a long line

Violeta Hernández (Aug 14 2024 at 03:22):

I don't know how/if this could be implemented, though

Violeta Hernández (Aug 14 2024 at 03:22):

What's the GitHub repo for the tool building the documentation?

Bryan Gin-ge Chen (Aug 14 2024 at 03:25):

It's here: https://github.com/leanprover/doc-gen4

(The repo containing the workflow that actually builds and deploys mathlib4 docs is here)

Damiano Testa (Aug 14 2024 at 03:30):

Would the substring <!----> in a doc-module/doc-string be displayed by doc-gen?

Damiano Testa (Aug 14 2024 at 03:48):

Damiano Testa said:

There is an analogous issue in exactly one other place in mathlib that you can find by grepping set_option linter.longLine false in (untested).

The exception is in Mathlib/Data/QPF/Multivariate/Basic.lean

/-!
...
each proves that some operations on functors preserves the QPF structure
-/

set_option linter.longLine false in
/-!
## Reference

[Jeremy Avigad, Mario M. Carneiro and Simon Hudon, *Data Types as Quotients of Polynomial Functors*][avigad-carneiro-hudon2019]
-/

Damiano Testa (Aug 14 2024 at 03:50):

If <!----> in doc-module strings is "invisible" to doc-gen, then the linter could ignore lines containing it as well.

Yaël Dillies (Aug 14 2024 at 07:41):

We already ignore lines containing http (or something like that) in the long lines linter(s). Can't we ignore lines that contain [...](...) or [...][...]?

Damiano Testa (Aug 14 2024 at 07:43):

Yes, but that may also ignore some (not properly spaced) assumptions in a lemma.

Yaël Dillies (Aug 14 2024 at 07:45):

Well, hopefully someone will write a separate linter against that? :wink:

Damiano Testa (Aug 14 2024 at 07:49):

Actually, Jon reviewed my "pedantic linter" that does check for whitespace issues!

Damiano Testa (Aug 14 2024 at 07:50):

However, that linter is really too strict, so the expectation is that it is not run by default.

Damiano Testa (Aug 14 2024 at 07:50):

For seriously linting style there should probably be a formatter for lean code.

Violeta Hernández (Oct 10 2024 at 10:06):

There's another one here: https://leanprover-community.github.io/mathlib4_docs/Mathlib/RingTheory/Artinian.html

Violeta Hernández (Oct 10 2024 at 10:06):

[samuel]


Last updated: May 02 2025 at 03:31 UTC