https://github.com/jf990/highlightjs-qml
highlight.js repo for Qt QML declarative language
https://github.com/jf990/highlightjs-qml
highlight-qml highlightjs qml qt webpage
Last synced: 6 months ago
JSON representation
highlight.js repo for Qt QML declarative language
- Host: GitHub
- URL: https://github.com/jf990/highlightjs-qml
- Owner: jf990
- License: apache-2.0
- Created: 2019-09-06T18:31:54.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-29T19:18:04.000Z (almost 5 years ago)
- Last Synced: 2025-05-19T16:32:37.415Z (7 months ago)
- Topics: highlight-qml, highlightjs, qml, qt, webpage
- Language: JavaScript
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# highlightjs-qml
[](https://github.com/jf990/highlightjs-qml/blob/master/LICENSE)
[](https://doc.qt.io/qt-5/qmlreference.html)
highlight.js language definition for Qt Company QML declarative language. See [Qt Documentation](https://doc.qt.io/qt-5/qmlreference.html) for language details. See https://highlightjs.org/ for more information about highlight.js.
## Usage
Follow instructions at [highlightjs](https://highlightjs.org/) 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:
```html
...
```
or use JavaScript to dynamically highlight text:
```javascript
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:
```html
hljs.registerLanguage("qml", window.hljsDefineQML);
hljs.initHighlightingOnLoad();
```
### webpack / rollup / browserify / node
```javascript
const hljs = require('highlightjs');
const hljsQML = require('highlightjs-qml');
hljsQML(hljs);
hljs.initHighlightingOnLoad();
```
## Contributing
Download this repo and install the dependencies:
```bash
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!
```bash
npm test
```
Issue a pull request.
## License
Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-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