Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,17 @@ function getSearchElement() {
return tmp;
}

function colorCode(s) {
var parts = s.split("`");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems extremely fragile. We should be using the builtin markdown renderer for this

if (parts.length < 3) {
return s;
}
for (var it = 1; it < parts.length; it += 2) {
parts[it] = "<code>" + parts[it] + "</code>";
}
return parts.join("");
}

function addTab(array, query, display) {
var extraStyle = "";
if (display === false) {
Expand Down Expand Up @@ -1458,7 +1469,7 @@ function getSearchElement() {
item.displayPath + "<span class=\"" + type + "\">" +
name + "</span></a></td><td>" +
"<a href=\"" + item.href + "\">" +
"<span class=\"desc\">" + escape(item.desc) +
"<span class=\"desc\">" + colorCode(escape(item.desc)) +
"&nbsp;</span></a></td></tr>";
});
output += "</table>";
Expand Down