Skip to content

Config reference: fix anchor scrolling and comment pairing - #8

Closed
predictiple wants to merge 6 commits into
masterfrom
theme-fixes-05
Closed

predictiple wants to merge 6 commits into
masterfrom
theme-fixes-05

Conversation

@predictiple

Copy link
Copy Markdown
Owner

Two fixes for the config reference page:

  • Anchor links — shared #fragment links to ref items were scrolling the target under the fixed navbar. Added scroll-margin-top to .ref-item cards so the item lands just below the navbar.
  • Comment pairing — each item's doc comment now lives in the same .ref-block as its item, so the filter hides both together. Container items keep the comment under the key inside the <summary>, and comments are emitted flush-left so Hugo doesn't mangle the markup.

Also on this branch: a collapsible "On this page" column. Two chevrons at the article's top-right corner (below the navbar) let readers fold the TOC away to give the article more room; the choice persists in localStorage, applied pre-paint. Desktop-only (xl+), hidden in print.

…idex#1310)

CI just started failing on Vale — not because of the content, but
because `version: latest` recently pulled in Vale 3.22.0.

3.22.0 introduced a tokenizer regression that merges words across
markdown links / inline HTML:

- `[Carbon Black](...)allows` → "Blackallows"
- `<span>Published</span>on` → "Publishedon"

None of the flagged files changed; the tool did. Confirmed locally
with the exact CI binaries: 3.21.0 passes, 3.22.0 fails.

This pins Vale to 3.21.0 so we can bump deliberately once it's fixed
upstream.
Items render key/breadcrumb/value as code and their documentation
comment as prose alongside. Each item and its comment share one
'.ref-block' div so the filter hides a block as a unit. Container
items keep the comment inside the collapsible <summary>, right under
the key, instead of below the expanded nested content where it would
fall off the page. Comments are emitted flush-left so Hugo's markdown
parser does not treat the closing </div> as an indented code block.
Shared #fragment links to config reference items scrolled the target
to the very top of the viewport, hiding it under the fixed navbar.
Give .ref-item cards a scroll-margin-top of the navbar height plus
breathing room so fragment links land the item just below the navbar.
The Hextra 'On this page' column can now be folded away entirely by a
reader-driven toggle, letting the article expand to the extra width.  Two
floating chevron buttons park at the article column's top-right corner, just
below the navbar: a right-facing collapse chevron while the column is expanded
and a left-facing expand chevron while it is collapsed.  The choice persists in
localStorage, applied before first paint by an inline script, so the column is
already the right width on first sight.

The buttons live outside the nav and use fixed positioning so they stay
reachable mid-scroll and survive the column being display:none.  Their offset
accounts for the announcement banner via --hextra-banner-height; the theme's
static default (2rem) is smaller than the real banner and it only re-measures
in deferred JS, so the default is pre-set to the measured 2.5rem here to avoid
a first-paint jump.  Text at xl gets extra right padding so it clears the
chevrons while scrolling.

Styled in custom.css as plain CSS: Hextra's prebuilt main.css is static, so new
hx: utilities are not generated.  Hides below the xl breakpoint (no TOC there)
and in print.  Implementation mirrors the existing sidebar-scroll persistence
pattern.
@predictiple

Copy link
Copy Markdown
Owner Author

Creating this against upstream instead

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.

1 participant