<link rel="stylesheet" href="https://slint-ui.com/resources/highlightjs/11.0.1/default.min.css">
<script src="https://slint-ui.com/resources/highlightjs/11.0.1/highlight.min.js"></script>
<script>
function highlight_slint(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 GridLayout Row HorizontalLayout VerticalLayout Path MoveTo LineTo ArcTo CubicTo QuadraticTo Close FocusScope Clip PopupWindow',
type:
'bool string int float length logical_length duration resource',
};
return {
name: 'slint',
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: /@/
};
};
for (let tag of ["slint", "slint,no-preview", "slint,no-auto-preview", "slint,ignore"]) {
hljs.registerLanguage(tag, highlight_slint);
}
window.addEventListener("DOMContentLoaded", () => {
const rustDoc = document.querySelector('meta[name="generator"]')?.content == "rustdoc";
if (rustDoc) {
for (slintBlock of document.querySelectorAll("[class*=language-slint]")) {
hljs.highlightElement(slintBlock)
}
for (codeBlock of document.querySelectorAll(".language-slint.hljs")) {
codeBlock.parentElement.classList.add("rust")
}
const highlightJSToRustDoc = [
["comment", "comment"],
["number", "number"],
["symbol", "struct"], ["keyword", "kw"],
["built_in", "primitive"],
["string", "string"],
["title", "fnname"], ["type", "type"]
];
for ([hljs_class, rustdoc_class] of highlightJSToRustDoc) {
for (titleElement of document.querySelectorAll(`.hljs-${hljs_class}`)) {
titleElement.classList.remove(`hljs-${hljs_class}`);
titleElement.classList.add(rustdoc_class);
}
}
} else {
hljs.highlightAll();
for (block of document.querySelectorAll("div[class*=highlight-slint] div.highlight pre")) {
hljs.highlightElement(block)
}
}
});
</script>