Add support for .60 syntax highlighting in C++ docs

Relates to #281
This commit is contained in:
Simon Hausmann 2021-07-07 13:58:47 +02:00
parent 77898796da
commit 43d20dece9
2 changed files with 17 additions and 0 deletions

View file

@ -2,4 +2,5 @@
{% block scripts %}
{{ super() }}
{% include "../../../sixtyfps-rs/sixtyfps-docs-preview.html" %}
{% include "../sixtyfps-docs-highlight.html" %}
{% endblock %}

View file

@ -0,0 +1,16 @@
<!--
This file is used to add syntax highlighting of the `.60` snippets in the generated C++ documentation.
It is injected in the Sphinx documentation via _templates/layout.html.
-->
<link rel="stylesheet" href="https://sixtyfps.io/highlight-default.css">
<script src="https://sixtyfps.io/highlight.pack.js"></script>
<script src="https://sixtyfps.io/highlight_60.js"></script>
<script>
window.addEventListener("DOMContentLoaded", () => {
// The Sphinx/my_st generated HTML for code blocks does not use <code> tags, so highlight.js'
// default selector "pre code" does not match. Let's do it by hand:
for (block of document.querySelectorAll("div.highlight-60 div.highlight pre")) {
hljs.highlightBlock(block)
}
});
</script>