Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 304cf9d

Browse files
author
mikesamuel
committed
Simplfied newline handling since IE seems to respect CRLFs in pre tags.
1 parent 68cd862 commit 304cf9d

2 files changed

Lines changed: 234 additions & 234 deletions

File tree

src/prettify.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,9 +1245,9 @@ function prettyPrintOne(s) {
12451245
if (null != t.style) {
12461246
// This interacts badly with some wikis which introduces paragraph tags
12471247
// into pre blocks for some strange reason.
1248-
// It's necessary for IE though which seems to lose the preformattedness
1249-
// of <pre> tags when their innerHTML is assigned.
1250-
html = html.replace(/(?:\r\n?)|\n/g, '<br>').replace(/ /g, '&nbsp; ');
1248+
// IE seems to ignore the newlines unless they're proper windows style
1249+
// CRLFs.
1250+
html = html.replace(/(?:\r\n?)|\n/g, '\r\n').replace(/ /g, '&nbsp; ');
12511251
}
12521252
out.push(html);
12531253
}

0 commit comments

Comments
 (0)