Fix documentation preview and hightlighting of .60 code with nightly rustdoc

rustdoc changed the html generated. The code used to be in a `<code>`, now it is
in a `<pre>`
So this should wotk with both stable rust and nightly rust
This commit is contained in:
Olivier Goffart 2021-08-11 18:20:18 +02:00
parent e24ff2bff4
commit bdeb64c518
2 changed files with 2 additions and 2 deletions

View file

@ -56,7 +56,7 @@
const rustDoc = document.querySelector('meta[name="generator"]')?.content == "rustdoc";
if (rustDoc) {
// Only highlight .60 blocks, leave the others to rustdoc
for (dot60Block of document.querySelectorAll("pre code.language-60")) {
for (dot60Block of document.querySelectorAll(".language-60")) {
hljs.highlightElement(dot60Block)
}

View file

@ -31,7 +31,7 @@
await sixtyfps.default();
var elements = document.querySelectorAll("code.language-60, div.highlight-60 div");
var elements = document.querySelectorAll("code.language-60, pre.language-60, div.highlight-60 div");
for (var i = 0; i < elements.length; ++i) {
let source = elements[i].innerText;
let div = document.createElement("div");