A fork for loongarch64
Find a file
Frank Dana f04b8a8058
Fix if*/elif* highlighting (#5)
A regular expression with alternation will take the first match
that succeeds, so if 'if' comes before 'ifarch', 'ifos', etc. then
the longer matches will never even be checked.
2023-03-01 17:39:58 -05:00
default.txt Initial commit of RPM Specfile syntax definition and demo sample 2019-07-08 22:14:21 -04:00
LICENSE Initial commit of RPM Specfile syntax definition and demo sample 2019-07-08 22:14:21 -04:00
README.md (chore) hljs.highlightAll(); 2022-02-25 16:14:22 -05:00
rpm-specfile.js Fix if*/elif* highlighting (#5) 2023-03-01 17:39:58 -05:00

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:

<script src="/path/to/highlight.pack.js"></script>
<script src="/path/to/highlightjs-rpm-specfile/rpm-specfile.js"></script>
<script>
  hljs.registerLanguage('rpm-specfile', window.hljsDefineRpmSpecfile);
  hljs.highlightAll();
</script>

If you're using webpack / rollup / browserify / node:

var hljs = require('highlightjs');
var hljsDefineRpmSpecfile = require('highlightjs-rpm-specfile');

hljsDefineRpmSpecfile(hljs);
hljs.highlightAll();

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);.