Skip to content

jf990/highlightjs-qml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

highlightjs-qml

License Language

highlight.js language definition for Qt Company QML declarative language. See Qt Documentation for language details. See https://highlightjs.org/ for more information about highlight.js.

Usage

Follow instructions at highlightjs to learn how to include the library and CSS. Then include qml as a registered language.

Mark the code you want to highlight with the qml class:

<pre><code class="qml">...</code></pre>

or use JavaScript to dynamically highlight text:

hljs.registerLanguage('qml', window.hljsDefineQML);
var highlighted = hljs.highlightAuto(text, ["qml"]);

Webpage

Include highlight.js distribution on your webpage, get the standard highlight.js distribution and then add the QML language highlighter from this repo:

<link rel="stylesheet" href="/path/to/css/default.css">
<script src="/path/to/highlight.js/highlight.pack.js"></script>
<script src="/path/to/highlightjs-qml/qml.js"></script>
<script>
    hljs.registerLanguage("qml", window.hljsDefineQML);
    hljs.initHighlightingOnLoad();
</script>

webpack / rollup / browserify / node

const hljs = require('highlightjs');
const hljsQML = require('highlightjs-qml');

hljsQML(hljs);
hljs.initHighlightingOnLoad();

Contributing

Download this repo and install the dependencies:

npm install

Update qml.js. Be sure to update the test data input.txt to include a test for your changes, or create a new test in qml-spec.js. The tests must pass!

npm test

Issue a pull request.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

About

highlight.js repo for Qt QML declarative language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published