gradlebuild.gradleprismjs

Syntax highlighting for build.gradle with Prism


For displaying a build.gradle sample code on my blog, I want to syntax highlighting with Prism.

But gradle is not included in the supported languages list. Are there any language-xxxx alternatives to highlighting gradle? Using language-nginx is a good choice?


Updated 2022-05-04:

You are now available Gradle thanks for the module's author ABDELKHALEK ZELLAT.


Solution

  • Gradle uses a domain-specific language (DSL) based on Groovy, so the language-groovy tag should highlight language elements like strings and braces. However, it won't highlight keywords related to Gradle, like task or the plugins, repositories and dependencies blocks. As those blocks may be added dynamically by third-party plugins, this is not possible for a syntax highlighter at all.

    Please note that Gradle provides an alternative DSL based on Kotlin that requires the build.gradle files to be restructured and renamed to build.gradle.kts. For those files, the tag language-kotlin might work even better.