Javascript debugging help for RPM specfile syntax highlighting?

The Discourse forum can do syntax highlighting for various languages and formats. For example, for HTML:

<a href="https://mattdm.org">mattdm.org</a>

One of the people at Discourse was kind enough to create an add on (a “theme component”) for this site which enables RPM syntax highlighting, using GitHub - highlightjs/highlightjs-rpm-specfile. (The theme component source is https://github.com/discourse/discourse-highlightjs-rpm.)

This seems to sort of work

Name:           dateutils
Version:        0.4.10
Release:        %autorelease
Summary:        Command-line date and time calculation, conversion, and comparison

License:        BSD
URL:            http://www.fresse.org/dateutils/
Source0:        https://github.com/hroptatyr/dateutils/releases/download/v%{version}/%{name}-%{version}.tar.xz

BuildRequires:  gcc
BuildRequires: make

%description
Tools which revolve around fiddling with dates and times on the command
line, with a strong focus on use cases that arise when dealing with large
amounts of financial data.


%prep
%autosetup -p1

… in that it’s identifying and bolding %description and %prep and so on. But looking at discourse-highlightjs-rpm/rpm-highlightjs.js at main · discourse/discourse-highlightjs-rpm · GitHub makes me think it should be handling Name:, Release:, etc. and other things too. Because:

        {
            className: "type",
            begin:  /^(Name|BuildRequires|BuildConflicts|Version|Release|Epoch|Summary|Group|License|Packager|Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|Requires\(?[a-z]*\)?|[a-zA-Z]+Req|Obsoletes|Recommends|Suggests|Supplements|Enhances|Provides|Conflicts|RemovePathPostfixes|Build[a-zA-Z]+|[a-zA-Z]+Arch|Auto[a-zA-Z]+)(:)/,
        },

… and there are other sections too.

Could someone take a look and see if there’s some obvious reason this isn’t happening?

Thank you!

Are you sure it is working at all? That looks like the default code highlighting to me. For example, here is the same thing with the default highlighting.

Name:           dateutils
Version:        0.4.10
Release:        %autorelease
Summary:        Command-line date and time calculation, conversion, and comparison

License:        BSD
URL:            http://www.fresse.org/dateutils/
Source0:        https://github.com/hroptatyr/dateutils/releases/download/v%{version}/%{name}-%{version}.tar.xz

BuildRequires:  gcc
BuildRequires: make

%description
Tools which revolve around fiddling with dates and times on the command
line, with a strong focus on use cases that arise when dealing with large
amounts of financial data.


%prep
%autosetup -p1

I believe that is because the default is to auto-detect. Try

    ```someinvalidtext 

And then compare rpm-specfile

That will remove all syntax highlighting.

In that case, the javascript is tagging those things to different classes. description and prep are tied to class keyword where the others are class type. Perhaps it has to do with the highlighting for those classes?