diff.rs icon indicating copy to clipboard operation
diff.rs copied to clipboard

Implement anchors for jumping to code

Open xfbs opened this issue 1 year ago • 1 comments

Something like:

  • https://diff.rs/view/serde/1.0.100/files/src/main.rs#L66
  • https://diff.rs/view/serde/1.0.100/files/src/main.rs#fn:main

Allows for creating permalink to functions/lines for viewing crates.

xfbs avatar Oct 30 '24 13:10 xfbs

I pushed a commit that implements the first step in making this possible.

Still need to do more things:

  • Make this work with single column view
  • Automatically expand if anchor line is hidden
  • Implement smooth scrolling (CSS scroll-behaviour: smooth)
  • Implement scroll margin (CSS scroll-margin-top: 100px)
  • Highlight anchor line
  • Make line numbers clickable (link to anchor)

xfbs avatar Oct 30 '24 23:10 xfbs