Slight possible issues with some syntax highlighting for one language

Steps to reproduce

I have a code block that is correctly shown when tested at https://prismjs.com/test.html#language=maxscript, and verified to be working at https://github.com/PrismJS/prism/pull/3181 after the original request here https://github.com/PrismJS/prism/issues/3059. I am trying to get the syntax highlighting to be shown the same within Obsidian. I created a quick test vault (see screenshot below) to demonstrate the differences. Perhaps some of the changes described in my first github link above may not have fully come through properly.

It is curious because the implementer of the MAXScript language into Prismjs wrote this after I had earlier pointed out that these functions were not coming through in Prismjs. They wrote:

" Added function calls (as [requested](https://github.com/PrismJS/prism/issues/3059#issuecomment-963732805) by [@I-d-as](https://github.com/I-d-as)). The detected syntax is intentionally restrictive to prevent false positives. This leads to a few false negatives (e.g. around case statements) but I think that’s okay for now."
This is taken from https://github.com/PrismJS/prism/pull/3181

Anyways, here is a screenshot that shows the Obsidian v0.14.2 Help Vault with the same code shown in the GitHub issue in links. I also have two browser windows open showing the original source of the code https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-4ED6C9C6-53B3-437C-969E-B8C924DF34AA and a preview on the test drive Prismjs page https://prismjs.com/test.html#language=maxscript.

In case someone was actually going to test my example, the language is MAXScript, so you can simply add “maxscript” without the quotes after the three backticks signifying the start of the code block. The script I showed was copied from this page https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-4ED6C9C6-53B3-437C-969E-B8C924DF34AA

When I preview the code, various functions do not get highlighted. I know this is not a top priority, but since the code previews correctly within PrismJs website test drive feature, maybe there is some sort of quick fix that will make it work.

Expected result

I would think (not necessarily expect) that the syntax highlighting would match PrismJs website’s test drive feature, since Obsidian uses Prismjs.

Actual result

The actual result is that many functions do not get highlighted.

Environment

  • Operating system: Windows 10

Thanks so much for considering this. I originally made a post here using the help category: Is it normal for code preview not to match prismjs test drive?

Much appreciated!

Obsidian works offline.
It’s simply possible that we haven’t updated to the latest version of prismjs yet.

1 Like

My bad! You are absolutely right. For some reason I thought the fixes had been merged into Prismjs version 1.25. But, upon looking closer, I realized it was actually Prismjs version 1.26. So, I just checked the developer console and it appears that Obsidian is using Prismjs version 1.25. So, I have something to look forward to. Thanks very much!

check when 0.14.3 comes out.

1 Like

Works like a charm in 0.14.3.

Thanks so much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.