Fix CMake syntax highlighting in the C++ tutorial

Use a version of highlight.js from our website that has CMake support
built-in, the one that comes with mdbook doesn't.
This commit is contained in:
Simon Hausmann 2021-06-17 13:47:46 +02:00
parent 59ebc94e71
commit cc8da495ae
6 changed files with 20 additions and 61 deletions

View file

@ -6,7 +6,7 @@ src = "src"
title = "SixtyFPS Memory Game Tutorial (C++)"
[output.html]
additional-js = ["../shared/highlight_60.js"]
theme = "../theme"
[output.linkcheck] # enable the "mdbook-linkcheck" renderer
optional = true

View file

@ -6,7 +6,7 @@ src = "src"
title = "SixtyFPS Memory Game Tutorial (Rust)"
[output.html]
additional-js = ["../shared/highlight_60.js"]
theme = "../theme"
[output.linkcheck] # enable the "mdbook-linkcheck" renderer
optional = true

View file

@ -1,59 +0,0 @@
/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
hljs.registerLanguage("60", function (hljs) {
const KEYWORDS = {
keyword:
'struct export import signal property animate for in if states transitions parent root self',
literal:
'true false',
built_in:
'Rectangle Image Text TouchArea Flickable Clip TextInput Window',
type:
'bool string int float length logical_length duration resource',
};
return {
name: 'sixtyfps',
aliases: ['60'],
case_insensitive: false,
keywords: KEYWORDS,
contains: [
hljs.QUOTE_STRING_MODE,
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE,
hljs.COMMENT('/\\*', '\\*/', {
contains: ['self']
}),
{
className: 'number',
begin: '\\b\\d+(\\.\\d+)?(\\w+)?',
relevance: 0
},
{
className: 'title',
begin: '\\b[_a-zA-Z][_\\-a-zA-Z0-9]* *:=',
},
{
className: 'symbol',
begin: '\\b[_a-zA-Z][_\\-a-zA-Z0-9]*(:| *=>)',
},
{
className: 'built_in',
begin: '\\b[_a-zA-Z][_\\-a-zA-Z0-9]*!',
},
],
illegal: /@/
};
});
document
.querySelectorAll("code.language-60")
.forEach((block) => hljs.highlightBlock(block));

View file

@ -0,0 +1,4 @@
<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>hljs.initHighlightingOnLoad();</script>

View file

@ -0,0 +1 @@
/* Disabled as part of disabling mdbook's highlight.js version, see highlight.js */

View file

@ -0,0 +1,13 @@
/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
// This file is empty to override and disable mdbook's built-in highlight.js
// version, which does not include CMake support. Instead the appropriate version
// of highlight.js is included via head.hbs