highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

(cmake) Folders starting by a number highlighted incorrectly

Open jcelerier opened this issue 1 year ago • 1 comments

Describe the issue Folders starting by a number are highlighted incorrectly in CMake.

Exemple:

image

Notice how the 3 at the beginning of 3rdparty is highlighted differently.

Which language seems to have the issue?

cmake

Are you using highlight or highlightAuto?

Ayu highlighting through mdbook... I don't know sorry.

Sample Code to Reproduce

project(my_app)

# example of folder structure
add_subdirectory(3rdparty/libremidi)

add_executable(my_app src/main.cpp)

target_link_libraries(my_app PRIVATE libremidi)

Expected behavior File names in CMake function calls are highlighted normally.

jcelerier avatar Nov 17 '24 00:11 jcelerier

I wonder if something like this would be sufficeint:

      {
        ...hljs.NUMBER_MODE,
        begin: /\b\d+(\.\d+)?\b/
      }

IE, just use a \b word boundary.

joshgoebel avatar Nov 17 '24 18:11 joshgoebel