leanprover / doc-gen4

Document Generator for Lean 4
Apache License 2.0
62 stars 41 forks source link

fix: `<url>` processing of markdown #189

Closed acmepjz closed 2 months ago

acmepjz commented 2 months ago

This PR fixes <url> processing problem of markdown introduced by #157. It turns out that the problem occurred at Lean.Xml.instToStringElement which does not do escape. The code is copied from Lean.Xml.instToStringElement with escape code added. The added functions should be removed once https://github.com/leanprover/lean4/issues/4411 is fixed.

discussion: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Contribution.20to.20doc-gen4.3F/near/443537944

acmepjz commented 2 months ago

Example of the changes of Init/Conv.html:

As you can see, the <url> in original line 146 is completely broken (https://leanprover-community.github.io/mathlib4_docs/Init/Conv.html#Lean.Parser.Tactic.Conv.conv), while this PR fixes it. This PR also introduces changes that " is replaced by &quot;, similarly for <, > and &, but these changes in HTML text does not affect rendering.

acmepjz commented 2 months ago

Need to ensure that #126 does not reappear.

acmepjz commented 2 months ago

have a reference to the upstream issue in the source

Done.

hargoniX commented 2 months ago

Looks fine to me, let's see if some users find pages that are broken again^^