I've written up a blog post on the Atlassian Developer Blog on how we came up with a technique to render line numbers for source code and diffs in Stash (now called Bitbucket Server) using a combination of CSS pseudo-elements ( :before
and :after
) and counters. Read about Stash's Pseudo Line Numbers (dead link).