highlightjs-rpm-specfile/README.md
Neal Gompa 68e385c4d5 Initial commit of RPM Specfile syntax definition and demo sample
Co-authored-by: Neal Gompa <ngompa13@gmail.com>
Co-authored-by: Ryan Lerch <rlerch@redhat.com>
2019-07-08 22:14:21 -04:00

34 lines
1.2 KiB
Markdown

`highlight.js` syntax definition for RPM spec files.
For more about highlight.js, see https://highlightjs.org/
For more about RPM, see https://rpm.org/
### Usage
Simply include the `highlight.js` script package in your webpage or node app, load up this module and apply it to `hljs`.
If you're not using a build system and just want to embed this in your webpage:
```html
<script type="text/javascript" src="/path/to/highlight.pack.js"></script>
<script type="text/javascript" src="/path/to/highlightjs-rpm-specfile/rpm-specfile.js"></script>
<script type="text/javascript">
hljs.registerLanguage('rpm-specfile', window.hljsDefineRpmSpecfile);
hljs.initHighlightingOnLoad();
</script>
```
If you're using webpack / rollup / browserify / node:
```javascript
var hljs = require('highlightjs');
var hljsDefineRpmSpecfile = require('highlightjs-rpm-specfile');
hljsDefineRpmSpecfile(hljs);
hljs.initHighlightingOnLoad();
```
### Advanced
This is a pretty simple package, the only thing you might want to do differently is name the language something other than `rpm-specfile`. If you want to do this, simply `import { definer } from 'highlightjs-rpm-specfile';` and use it like: `hljs.registerLanguage('othername', definer);`.