Skip to content

feat: add Html type - #14935

Open
Vtec234 wants to merge 9 commits into
downstream-greenfrom
html-type
Open

Vtec234 wants to merge 9 commits into
downstream-greenfrom
html-type

Conversation

@Vtec234

@Vtec234 Vtec234 commented Aug 27, 2026

Copy link
Copy Markdown
Member

This PR adds a type Lean.Data.Html of HTML forests — aimed primarily at authoring HTML (as opposed to internal representation in a web server, etc) — as well as a renderer that produces a String object.

Rendering directly into FS.Stream is out of scope for this PR.

Downstream adoption (not merely adaptation to make CI pass) PRs that use the new type and renderer:

@Vtec234 Vtec234 added the downstream Request a downstream-lean4 adaptation PR. label Aug 27, 2026
@Vtec234
Vtec234 changed the base branch from master to downstream-green August 27, 2026 04:08
@github-actions github-actions Bot added toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN labels Aug 27, 2026
@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label Aug 27, 2026
@leanprover-bot

leanprover-bot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Aug 27, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Aug 27, 2026

Copy link
Copy Markdown

Mathlib CI status (docs):

Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Aug 31, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Aug 31, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Aug 31, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Sep 2, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Sep 2, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Sep 2, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Sep 2, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Sep 2, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Sep 2, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Sep 2, 2026
leanprover-bot added a commit to leanprover/reference-manual that referenced this pull request Sep 2, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/mathlib4-nightly-testing that referenced this pull request Sep 2, 2026
mathlib-nightly-testing Bot pushed a commit to leanprover-community/batteries that referenced this pull request Sep 2, 2026
@Vtec234
Vtec234 added this pull request to stack #15148 September 13, 2026 20:44
@Vtec234
Vtec234 marked this pull request as ready for review September 13, 2026 20:56
@downstream-lean4

Copy link
Copy Markdown

The adaptation PR for this PR is leanprover/downstream-lean4#25.

Comment thread src/Lean/Data/Html/Basic.lean Outdated

namespace Lean

/-- A forest of HTML trees.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/-- A forest of HTML trees.
/--
A forest of HTML trees.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would also expand this a little bit, because "forest of trees" may not be immediately obvious.

What about something like:

HTML content, which may be either a single node or a sequence of sibling nodes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changed wording. To clarify - why does the newline matter?

Comment thread src/Lean/Data/Html/Basic.lean Outdated
This type is optimized for convenient authoring of HTML documents.
It is not formally related to
the [HTML DOM representation](https://html.spec.whatwg.org/dev/dom.html).
It is analogous to React's [Fragment](https://react.dev/reference/react/Fragment). -/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
It is analogous to React's [Fragment](https://react.dev/reference/react/Fragment). -/
It is analogous to React's [Fragment](https://react.dev/reference/react/Fragment).
-/

How stable is that link? We don't yet have a link checker as part of Lean CI for external links.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It has existed since 2023. React have moved their docs across domains once already, although the old link from 2018 (https://reactjs.org/docs/fragments.html) continues to work.

Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Basic.lean Outdated
Comment thread src/Lean/Data/Html/Printer.lean Outdated
Comment thread src/Lean/Data/Html/Printer.lean Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR builds-mathlib CI has verified that Mathlib builds against this PR changelog-added downstream Request a downstream-lean4 adaptation PR. mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants