diff options
author | Chris Warrick <kwpolska@gmail.com> | 2021-12-31 19:51:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-31 19:51:31 +0100 |
commit | 346564d693117b8ebc9606511bc83627971c7ac2 (patch) | |
tree | 1dfb7c77e5dd097d3cb23f974c14473281b18ee0 /pygments/formatters | |
parent | a2ff2f095ac522bde768b290a3b6d0de4d828ef7 (diff) | |
download | pygments-git-346564d693117b8ebc9606511bc83627971c7ac2.tar.gz |
Generate valid links if lineanchors but no linenos set (#2013)
Diffstat (limited to 'pygments/formatters')
-rw-r--r-- | pygments/formatters/html.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index ba2df3fa..f3a77a2d 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -772,7 +772,7 @@ class HtmlFormatter(Formatter): for t, line in inner: if t: i += 1 - href = "" if self.linenos else ' href="%s-%d"' % (s, i) + href = "" if self.linenos else ' href="#%s-%d"' % (s, i) yield 1, '<a id="%s-%d" name="%s-%d"%s></a>' % (s, i, s, i, href) + line else: yield 0, line |