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:
commit
e918a589ae
4 changed files with 50 additions and 9 deletions
|
@ -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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue