Skip to content

Permalinks for inline headings - #3168

Open
ascholerChemeketa wants to merge 2 commits into
PreTeXtBook:masterfrom
ascholerChemeketa:permalinks-for-inline
Open

Permalinks for inline headings#3168
ascholerChemeketa wants to merge 2 commits into
PreTeXtBook:masterfrom
ascholerChemeketa:permalinks-for-inline

Conversation

@ascholerChemeketa

Copy link
Copy Markdown
Contributor

Cleanup for inline heading logic in CSS based on:
#3150

Ties link "hide permalink" for affected elements to the fact that a particular element has an inlined heading, not on its type (.solution-like, .proof, etc...).

@rbeezer

rbeezer commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

I'm working on the assumption this replaces #3150 - that is not 100% clear to me from reading comments. Report from Claude, just now. I'm not concerned about degrading legacy themes.

@rbeezer

rbeezer commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

The direction here is right — suppressing the permalink where a heading is genuinely inline, rather than by a list of block names, is the version that will keep working as themes change. Bringing .exercisegroup and the three themes' .solution-like onto the shared mixin is a real simplification, and the exercisegroup case it fixes is the one reported.

Building the branch and comparing it against master on identical HTML, though, the rule that comes out of _permalinks.scss was doing more work than the mixin currently replaces.

That rule hid the first-paragraph permalink across a dozen block types. The mixin only fires where a block actually has an inline heading, which is the point — but a few blocks were relying on the old rule and do not get the mixin. On the sample article with theme-default-modern:

first-paragraph permalink master this branch
exercisegroup 1 visible (the bug) 0 visible ✓
solution-like 0 visible, 3 hidden 3 visible
assemblage-like 0 visible, 1 hidden 1 visible
theorem, remark, example, proof, definition, computation, project, exercise hidden hidden ✓

.solution-like picks up the mixin in denver, greeley and tacoma, but not in default-modern, which is why solutions fall through in the default theme. Three more appear inside knowl content on the exercises page — not visible until a reader opens the knowl, but they are there.

Those blocks all carry their own permalink already, so a second one on their first paragraph is duplication, which is presumably what the old rule was for. Either extending the mixin to cover them, or keeping a narrowed version of the old rule for blocks that have a permalink of their own, would close it.

One other thing worth knowing, since it bears on whether this closes the issue by itself rather than on anything in the diff. The exercisegroup fix rides on the component layer, and the legacy themes do not pull that in, so it does not reach them:

built theme exercisegroup suppression
theme-default-modern present
theme-default-legacy absent

#3150 addresses the same symptom in the stylesheet instead, where the permalink is never generated and every theme is covered. The two are not in conflict — if that one lands, it simply makes the exercisegroup half of this redundant, and the consolidation here is still worth having on its own terms.

Claude Opus 5, acting as a review assistant for Rob Beezer

@ascholerChemeketa

Copy link
Copy Markdown
Contributor Author

Yes, this is offered as a deeper fix for the problem #3150 addresses.

The reason permalinks for exercisegroup's first p need to be suppressed is that the exercisegroups have an inline heading. An alternate presentation of exercisegroup with a stand alone heading would not need to suppress the heading. So we don't want to say "excercisegroup's first p never needs a permalink" as that statement is overly broad.

Updated to address issue Claude found. That fix revealed another wrinkle - default-modern had some constructs getting styles for both inline and not inline headings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants