summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
Diffstat (limited to 'pygments')
-rw-r--r--pygments/formatters/html.py15
-rw-r--r--pygments/style.py4
2 files changed, 12 insertions, 7 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index 6b36183d..3ba104f3 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -552,9 +552,9 @@ class HtmlFormatter(Formatter):
def get_linenos_style_defs(self):
lines = [
'pre { %s }' % self._pre_style,
- 'td.linenos pre { %s }' % self._linenos_style,
+ 'td.linenos .normal { %s }' % self._linenos_style,
'span.linenos { %s }' % self._linenos_style,
- 'td.linenos pre.special { %s }' % self._linenos_special_style,
+ 'td.linenos .special { %s }' % self._linenos_special_style,
'span.linenos.special { %s }' % self._linenos_special_style,
]
@@ -682,7 +682,7 @@ class HtmlFormatter(Formatter):
if special_line:
style = ' class="special"'
else:
- style = ''
+ style = ' class="normal"'
if style:
line = '<span%s>%s</span>' % (style, line)
@@ -930,11 +930,16 @@ class HtmlFormatter(Formatter):
linewise, e.g. line number generators.
"""
source = self._format_lines(tokensource)
+
+ # As a special case, we wrap line numbers before line highlighting
+ # so the line numbers get wrapped in the highlighting tag.
+ if not self.nowrap and self.linenos == 2:
+ source = self._wrap_inlinelinenos(source)
+
if self.hl_lines:
source = self._highlight_lines(source)
+
if not self.nowrap:
- if self.linenos == 2:
- source = self._wrap_inlinelinenos(source)
if self.lineanchors:
source = self._wrap_lineanchors(source)
if self.linespans:
diff --git a/pygments/style.py b/pygments/style.py
index 989a61cd..3bf2b156 100644
--- a/pygments/style.py
+++ b/pygments/style.py
@@ -176,10 +176,10 @@ class Style(metaclass=StyleMeta):
highlight_color = '#ffffcc'
#: line number font color
- line_number_color = '#000000'
+ line_number_color = 'inherit'
#: line number background color
- line_number_background_color = '#f0f0f0'
+ line_number_background_color = 'transparent'
#: special line number font color
line_number_special_color = '#000000'