Custom TextMate language grammar produces no syntax highlighting in code blocks #3401
HugoAVaz
started this conversation in
Bugs & Feedback
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Custom TextMate language grammar produces no syntax highlighting in code blocks
Description
Custom syntax highlighting for a custom language (
lot) defined viastyling.codeblocks.languages.custominmint.jsondoes not produce any token highlighting. All code blocks using the custom language render as plain unstyled monospace text -- no<span>elements with token colors are generated in the HTML output.Configuration
mint.json (relevant section):
CSS variables defined in global.css:
Grammar file (
/languages/lot.json) -- valid TextMate grammar JSON:{ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "name": "lot", "scopeName": "source.lot", "fileTypes": ["lot", "lotnb"], "patterns": [ { "include": "#comments" }, { "include": "#strings" }, { "include": "#numbers" }, { "include": "#keywords" }, { "include": "#types" }, { "include": "#constants" }, { "include": "#variables" }, { "include": "#operators" } ], "repository": { "comments": { "patterns": [ { "name": "comment.line.double-dash", "match": "--.*$" }, { "name": "comment.line.double-slash", "match": "//.*$" } ] }, "strings": { "patterns": [ { "name": "string.quoted.double", "begin": "\"", "end": "\"", "patterns": [{ "name": "constant.character.escape", "match": "\\\\." }] } ] }, "numbers": { "patterns": [ { "name": "constant.numeric", "match": "\\b[0-9]+\\.?[0-9]*\\b" } ] }, "keywords": { "patterns": [ { "name": "keyword.control", "match": "\\b(DEFINE|ACTION|MODEL|ROUTE|RULE|ON|DO|EVERY|IF|THEN|ELSE|WITH|AS|FROM|TO|IN|USING|FOR|RETURN|INPUT|OUTPUT|BETWEEN|AND|OR|NOT|DELETE|START|STOP)\\b" }, { "name": "keyword.other", "match": "\\b(TOPIC|PUBLISH|KEEP|GET|SET|ADD|TRIGGER|CALL|PYTHON|MCP|JSON|POSITION|RANDOM|REPLACE|FILTER|TRIM|SPLIT|CSV|REGEX|SEPARATOR|HEADERS|PRESENT|NONE|MAPPING|EVENT|SOURCE_TOPIC|DESTINATION_TOPIC|DIRECTION|COLLAPSED|ENV|SECRET)\\b" } ] }, "types": { "patterns": [ { "name": "storage.type", "match": "\\b(STRING|INT|DOUBLE|BOOL|OBJECT|ARRAY|INTEGER|BOOLEAN|FLOAT)\\b" }, { "name": "entity.name.class", "match": "\\b(MQTT_BRIDGE|MQTT_CLUSTER|OPENSEARCH|EMAIL|CRATEDB|POSTGRESQL|MONGODB|REST_API|MODBUS_TCP|MODBUS_SERIAL|SIEMENS_S7|OPCUA|ADS|ALLEN_BRADLEY|ETHERNETIP|FINS)\\b" } ] }, "constants": { "patterns": [ { "name": "constant.language", "match": "\\b(PAYLOAD|TIMESTAMP|EMPTY|TRUE|FALSE|true|false|UTC|UNIX|UUID|GUID|ULID)\\b" }, { "name": "constant.other", "match": "\\b(SECONDS?|MINUTES?|HOURS?|DAYS?|WEEKS?)\\b" } ] }, "variables": { "patterns": [ { "name": "variable.other", "match": "\\{[a-zA-Z_][a-zA-Z0-9_\\.]*\\}" } ] }, "operators": { "patterns": [ { "name": "keyword.operator", "match": "(==|!=|>=|<=|>|<|\\+|\\-|\\*|/|%)" } ] } } }Usage in Markdown
Expected behavior
Keywords like
DEFINE,ACTION,ON,EVERY,DO,PUBLISH,TOPIC,WITHshould render with--mint-token-keywordcolor. Strings like"system/alive"should render with--mint-token-stringcolor. Each token should be wrapped in a<span>with the appropriate CSS variable applied.Actual behavior
The entire code block renders as plain text in a single color. No token
<span>elements are generated in the HTML output. The custom grammar is not being loaded by Shiki during the build -- the language identifierlotis treated as unrecognized and falls back to plain text.Screenshots
What we see (no highlighting):
All tokens are the same grey/white color in the rendered code block. No differentiation between keywords, strings, constants, or comments.
Live example
https://docs.coreflux.org/lot-language/introduction -- see the "Hello World" code blocks.
Steps to reproduce
/languages/lot.jsonmint.jsonunderstyling.codeblocks.languages.customstyling.codeblocks.themeto"css-variables"--mint-token-*CSS variables inglobal.css```lotcode fences in any markdown pageEnvironment
mint.json(not yet migrated todocs.json)Beta Was this translation helpful? Give feedback.
All reactions