Skip to content

Line-number anchor links (shareable deep links) #7

Description

@ajaydsouza

Summary

Make line numbers clickable, producing shareable GitHub-style deep links (#wzcbh-1-L12) that scroll to and highlight the target line.

Details

  • Assign each code block a stable per-post index/id; line-number elements become anchors.
  • Small frontend script (shared by both modes) handles hash parsing on load, scroll-into-view, and applying a temporary highlight class (reuse .wzcbh-highlighted-line styling).
  • Support ranges (L5-L10) like GitHub; copy-link affordance on click.
  • Requires line numbers enabled; interplay with expand/collapse (aria-expanded button) — auto-expand a collapsed block when its hash is targeted.

Why

Lets readers and support staff link to an exact line in documentation/KB articles — invaluable for long snippets.

Speed to implement: Medium · Usefulness: Medium · Rank: 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions