rollup merge of #20092: barosl/rustdoc-line-number-clickable
While talking on IRC, someone wanted to post a link to the Rust source code, but while the lines of the rendered source code do have anchors (`<span id="[line number]">`), there is no convenient way to make links as they are not clickable. This PR makes them clickable. Also, a minor fix of the FAQ is included.
This commit is contained in:
@@ -2253,9 +2253,9 @@ impl<'a> fmt::Show for Source<'a> {
|
||||
cols += 1;
|
||||
tmp /= 10;
|
||||
}
|
||||
try!(write!(fmt, "<pre class='line-numbers'>"));
|
||||
try!(write!(fmt, "<pre class=\"line-numbers\">"));
|
||||
for i in range(1, lines + 1) {
|
||||
try!(write!(fmt, "<span id='{0}'>{0:1$}</span>\n", i, cols));
|
||||
try!(write!(fmt, "<span id=\"{0}\">{0:1$}</span>\n", i, cols));
|
||||
}
|
||||
try!(write!(fmt, "</pre>"));
|
||||
try!(write!(fmt, "{}", highlight::highlight(s.as_slice(), None, None)));
|
||||
|
||||
Reference in New Issue
Block a user