summaryrefslogtreecommitdiff
path: root/pygments/formatters
diff options
context:
space:
mode:
authorChris Warrick <kwpolska@gmail.com>2021-12-31 19:51:31 +0100
committerGitHub <noreply@github.com>2021-12-31 19:51:31 +0100
commit346564d693117b8ebc9606511bc83627971c7ac2 (patch)
tree1dfb7c77e5dd097d3cb23f974c14473281b18ee0 /pygments/formatters
parenta2ff2f095ac522bde768b290a3b6d0de4d828ef7 (diff)
downloadpygments-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.py2
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