Skip to content

Commit 3d843d0

Browse files
xFrednetsyphar
authored andcommitted
Address PR comments <3
1 parent e5c03ae commit 3d843d0

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

static/source.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
});
4040
});
4141

42-
// This code has been adapted from the rustdoc implementation here:
43-
// https://github.com/rust-lang/rust/blob/5c848860/src/librustdoc/html/static/js/src-script.js#L152-L204
42+
// This code has been adapted from the rustdoc implementation
4443
function highlightLineNumbers() {
4544
const match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
4645
if (!match) {
@@ -76,7 +75,7 @@
7675
}
7776
}
7877

79-
const handleLineNumbers = (function () {
78+
const handleLineNumbers = (function() {
8079
let prev_line_id = 0;
8180

8281
const set_fragment = name => {
@@ -122,7 +121,7 @@
122121
};
123122
}());
124123

125-
window.addEventListener("hashchange", highlightLineNumbers)
124+
window.addEventListener("hashchange", highlightLineNumbers);
126125

127126
Array.from(document.getElementById("line-numbers").children[0].children).forEach(el => {
128127
el.addEventListener("click", handleLineNumbers);

templates/crate/source.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
<div id="source-code-container" class="pure-u-1 pure-u-sm-17-24 pure-u-md-19-24">
131131
<div data-nosnippet class="source-code"><pre id="line-numbers"><code>
132132
{%- for line in 1..=file_content.lines().count() -%}
133-
<a href="#{{line|safe}}" id="{{line|safe}}">{{line|safe}}</a>
133+
<a href="#{{line}}" id="{{line}}">{{line}}</a>
134134
{%~ endfor -%}
135135
</code></pre></div>
136136
<div id="source-code" class="source-code">

0 commit comments

Comments
 (0)