Skip to content

Commit 0bf3b9a

Browse files
Merge pull request #6 from marijnh/master
Fork Sync
2 parents 964a717 + 01e0d2d commit 0bf3b9a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

html/errata.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h2>Chapter 11</h2>
6767

6868
<h2>Chapter 14</h2>
6969

70-
<p><strong>Page 231</strong> <em>Moving Through the Tree</em>: Below
70+
<p><strong>Page 231</strong> (5th) <em>Moving Through the Tree</em>: Below
7171
the code example, the text claims
7272
that <code>for</code>/<code>of</code> loops don't work on DOM child
7373
lists. But in current (even as of the book's release) browsers they
@@ -93,8 +93,9 @@ <h2>Chapter 16</h2>
9393

9494
<h2>Chapter 19</h2>
9595

96-
<p><strong>Page 336</strong> <em>The State</em>: The text mentions the
97-
property `fillColor` where it should say `fillStyle` instead.
96+
<p><strong>Page 336</strong> (5th) <em>The State</em>: The text mentions the
97+
property <code>fillColor</code> where it should
98+
say <code>fillStyle</code> instead.
9899

99100
<h2>Chapter 20</h2>
100101

src/render_html.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ function maybeSplitInlineCode(html) {
5454
const seenIDs = Object.create(null)
5555
function anchor(token) {
5656
let id = token.hashID
57-
if (!id || id in seenIDs) return ""
57+
if (id in seenIDs) for (let i = 1;; i++) {
58+
let ext = id + "_" + i
59+
if (!(ext in seenIDs)) { id = ext; break }
60+
}
5861
seenIDs[id] = true
5962
return `<a class="${id.charAt(0)}_ident" id="${id}" href="#${id}" tabindex="-1" role="presentation"></a>`
6063
}

0 commit comments

Comments
 (0)