It sounds like obsidian used prismjs for code block syntax highlighting? According to Prism,
gcode is a supported language. But using that in obsidian doesn’t do anything special:
Looks like gcode support was added to prismjs in 2018 (request: gcode highlighting · Issue #1571 · PrismJS/prism · GitHub) - I doubt the version obsidian is using is that old?
For bug reports, please test it in the Sandbox vault with default theme, and no plugins. I’ve moved this to Help.
It’s working for me in the default theme. I just grabbed some random example on the internet since your code is a screenshot. Can you test with default theme? And if it still doesn’t work, post the results of the “Show debug info” command.
M83 ; switch
G17 G20 G90 G94 G54
G01 Z0. F5.
G02 X0. Y0.5 I0.5 J0. F2.5
X0.5 Y0. I0. J-0.5
X0. Y-0.5 I-0.5 J0.
X-0.5 Y0. I0. J0.5
G01 Z0.1 F5.
G00 X0. Y0. Z0.25
I am on the default theme, but “Dark” color scheme.
Here’s the results of “Show debug info”:
Obsidian version: v1.0.3
Installer version: v0.15.9
Operating system: Windows 10 Enterprise 10.0.22621
Login status: logged in
Catalyst license: none
Insider build toggle: off
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 4
Plugins enabled: 4
1: Todoist Plugin v1.9.0
2: Editor Syntax Highlight v0.1.3
3: Recent Files v1.3.3
4: Icon Folder v1.3.5
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.
I’ll give it a try in the sandbox vault
AH - I believe I’ve figured it out. This seems to be specific to the “Live Preview” view. If I switch to “Reading” view then I get syntax highlighting
Oh yeah I can confirm that, at least in version 1.0.0+.
I don’t remember that being the case when I tested it back in September. But now I see the same thing. No syntax highlighting until you go in Reading Mode.
Python, for example highlights in both Reading and Live Preview.
But I think gcode was working in both before. But maybe not!
(I don’t know if this should be put back to a Bug, or if this is just an upstream dependency of Prism.)