summaryrefslogtreecommitdiff
path: root/pygments/formatters/html.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/formatters/html.py')
-rw-r--r--pygments/formatters/html.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index d65c09ce..54e7df0e 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -803,7 +803,13 @@ class HtmlFormatter(Formatter):
# else we neither have to open a new span nor set lspan
if line:
- line.extend(((lspan and '</span>'), lsep))
+ # If we're in nowrap mode, we try to make the output compact and
+ # omit the trailing newspace, this makes it easier to consume the
+ # HTML elsewhere
+ if self.nowrap:
+ line.append(lspan and '</span>')
+ else:
+ line.extend((lspan and '</span>', lsep))
yield 1, ''.join(line)
def _lookup_ctag(self, token):