No syntax highlight for some languages in editing mode
Hello 👋 , There are some cases (like with GraphQL) where I don’t see any syntax highlighting in editing mode — it only appears in reading mode. Do you happen to know why this might happen?
Editing mode:
Reading mode:
Markdown:
query OrderQuery {
order{
lines {
sku
}
}
}
int main() {
printf("ad");
}
'result if true'.method() if 1 else result_if_false.property
Hi,
yes. The editing view and the reading view are 2 completely different things. In editing mode Obsidian uses the editor (called CodeMirror). CodeMirror is what provides syntax highlighting. In reading mode Obsidian uses prism.js for syntax highlighting. In this specific case CodeMirror does not provide any syntax highlighting, but prism.js does. Thats why the syntax highight is different or missing (like in this case). It is possible to write packages for syntax highlighting for CodeMirror, however, that is not very complex. But you might have luck, because I jut saw, that there might be a package for graphql. I will look at later. Maybe I can add that package for you.