-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templater Syntax Highlight is broken on Obsidian 1.5.0 (Desktop - Catalyst/Insider release) #1251
Comments
Can reproduce, will investigate. Thanks! |
Update: This will be tricky for me to fix. Looks like with the deprecation of CodeMirror 5 in Obsidian 1.5.0, the previous way of adding syntax highlighting will no longer work and will have to be rewritten. I am not very experienced in CodeMirror, so migrating the code to CodeMirror 6 will take some time. When it is fixed, it may not be exactly the same as it was before. |
Given that highlighting still works on mobile, which is CM6, you can likely just unify the both of those now. The highlighter is a |
I don't think it's the deprecation of CM5 itself that broke it, rather some side effect of that change broke it. I've tried a few things trying to get the |
It might be necessary to work out what's changed between the APIs. I'll let you know if I find anything. |
According to some discussions I've had internally, the removal of CM5 has resulted in Strangely enough, this should never have worked on mobile, but I cannot see where else in the codebase the mode would be handled for mobile specifically. The syntax is created here as an overlay on HyperMD, and is defined correctly using |
Possibly mixed language parsing might be helpful. |
I have a PR open #1263 that fixes this. While there was some work to fix the dynamic loading and unloading of the highlighter, the basic issue came from the fact that 1.5.x changed the priority for the default |
Released in 2.0.0 of Templater! Thank you so much @iamrecursion !
|
@Zachatoo Are you sure about the mobile thing? I have plugin sync on and it was working on mobile during my testing! Mobile has always used CM6, and the new way of doing things should be compatible. |
Yeah, can confirm it's still working on mobile even in the full 2.0.0 release. |
I had to restart Obsidian, now syntax highlighting is working for me on mobile on 2.0.0. That's my bad! |
Phew! Was worried I'd broken something strange for a moment there! |
I just really need to say this 😄 : Thank you so so so very much to the both of you @iamrecursion and @Zachatoo for fixing this 🙌 🥳 !!! It works perfectly on Desktop (Obsidian 1.5+) and Mobile (Obsidian 1.4.16) 🎉 !!! |
It might be worthwhile to port the syntax highlighting to a CM6 View Plugin that creates mark decorations. That approach should be a lot simpler, more powerful and future-proof. I am using such an approach in Meta Bind. I would consider writing a PR for this. |
Hi there 😊 !
This is much more a visual bug than anything else (apparently) but the Desktop Catalyst release of Obsidian
1.5.0
broke Templater's syntax higlighter 😔 ...Hoping this is something that can be fixed (🍀 ), here I am 😊 ...
Plugin information:
MacOS Big Sur 11.7.10
1.18.1
1.5.0
(Catalyst/Insider release)/Temp
On
Off
On
On
On
None
set upEnabled
but none set upNone
Disabled
Describe the bug:
Apparently, the Catalyst release of
Obsidian 1.5.0
(Desktop) doesn't seem to play well with Templater's syntax highlighter and all templates are now rendered as simple.md
files 😔 .In terms of functionality, the templates still seem to work as expected but writing and/or re-reading a long and complex template can now be a bit hard and confusing experience 🥺 ...
Expected behavior:
If possible 🥺 , I really would like to have Templater's syntax highlight back 😊
Screenshots:
I wish I would be able to do a before/after comparison but:
Screenshot 1: From the Sandbox Vault (+ Templater)
Here's how a template now looks like in the Sandbox Vault.
(The template works as expected though 😊 )
Screenshot 2: From a messy "Test" vault
And here's a weird looking templater's template from one of my messy test vaults 🙃 :
Live Preview
vs.Source Mode
It seems like Obsidian is actively trying to render the
HTML
and markdown link used in this template, leading to some gaps in Live Preview, instead of considering this.md
file as what it actually is: a template 😔 .Additional context:
I didn't change anything in my vaults other than rebooting Obsidian once the Catalyst/Insider release was installed 😊 .
I really really do hope a fix exists for this visual issue 🍀 😇 (for the sake of the template's readability) ...
Thank you so very much in advance for any help regarding this 🙌 !!!
The text was updated successfully, but these errors were encountered: