Support ordered groups of inline stylesheets in Verso Manual

Open
#1,133 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Domain
documentation

Research direction

Start with the extraCss collection in src/verso-manual/VersoManual/Html/Features.lean and the page emitter in src/verso-manual/VersoManual/Html.lean. Trace how extensions and project head entries contribute styles in single-page and multipage output, then identify where an ordered group can preserve the specified cascade placement. Done means the regression cases in the issue pass, including repeat use, unrelated sheet changes, and a later project override.

Written by the indexing model from the issue text.

Description

Manual extensions can contribute inline CSS through extraCss. The traversal state collects it in a hash set, and the page emitter uses extraCss.toArray. The CSS cascade resolves equal-specificity rules by source order, so changes to the set of collected sheets can change which rule wins.

In Verso Blueprint's visual redesign, removing the stylesheet for an unrelated style switcher moved the Blueprint block stylesheet from tenth to first among 14 inline style blocks. Verso's docstring rules then overrode the Blueprint rules and declaration panels grew from 0.86rem to 1rem. The declaration-panel rules themselves were unchanged.

Could Manual let an extension declare its own inline stylesheets as an ordered group, with documented placement in the page cascade? Blueprint needs Manual defaults first, then its own sheets in declared order, followed by project overrides supplied as head entries. Projects and other extensions can also contribute extraCss, including selectors for Blueprint classes. A group would let Blueprint state its own order without taking ownership of those sheets. The API shape is open.

As a regression case, register two sheets in one group with different values for the same property and selector. Check that the second sheet wins in single-page and multipage output after adding, editing or removing an unrelated sheet. Repeated uses of the same extension should emit its group only once, and a later project head override should still win a tie.

Blueprint currently marks its own sheets and emits an ordered copy before project head entries. The original copies still appear in every page. In the reported starter Addition example, the HTML grew from 210 KB to 268 KB with the workaround. An upstream ordering mechanism would let us remove the duplicate emission. This request is for inline CSS, independently of linked stylesheet and script assets.

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from leanprover/verso

All issues in leanprover/verso

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.