Open vburzynski opened 1 year ago
Templater does support replacing Templater tags inside of codeblocks, so it does make sense why it does it's syntax highlighting. I definitely don't think we should remove support for Templater tags in codeblocks, but I do think there's an argument for disabling just the syntax highlighting in codeblocks.
'm trying to document some code and the code blocks are behaving a little differently in a callout vs just being in the note independently. I looked on the forums but couldn't find anything to solve the issue but what I did find was people discussing that the java <> brackets may be causing a rendering issue possible that it thinks there are HTML instead of just code.
Below is a screen shot of what I am seeing, on the left is the source of the MD file the Right is rendered in Read View. Unfortunately the render is not always consistent, sometime its completely off without any change but there is no discernable pattern to it.
I have tried to use other characters in place of the <> like escaping it or even using < but the render just looks the same it does in edit mode, it doesn't resolve to anything
I tried a clean vault with no plugins and it worked like I would expect it to. Im ok with putting escape character within my code block but when I add them and go to the reading pane it shows the escape character as well as the charter is supposed to escape in the first place.
Again if there was a way to escape the character in the editing page but rendered correctly I would be fine and I think that would solve the problem for most.
I think I came across the same bug. I'm not a 100% sure it's actually a bug though. Using the following note content:
```bash
echo '<%'
I am outside the codeblock
Templater shows this as:
![CleanShot 2024-02-23 at 15 21 33](https://github.com/SilentVoid13/Templater/assets/327080/63682719-af8f-4b5e-967e-573fda5cfed2)
Disabling Templater's setting "Syntax Highlighting on Desktop" (I'm working on desktop) produces this:
![CleanShot 2024-02-23 at 15 22 27](https://github.com/SilentVoid13/Templater/assets/327080/d571abd4-5d19-4a22-98b0-6a7c953d139b)
I also think that's a bug, the mere presence of <%
just destroys the code block rendering. I had to disable every plugin until I found that templater was causing this issue with my code blocks.
Interesting is there a way to escape that? or even use some sort of char code ASCII 60 and 37 to display instead of the actual <% or even a unicode character number
ASCII
>% = <%
%< = %>
UTF-8
<% = <%
%> = %>
Im sorry just having a little trouble following this last part of the thread, is this issue being tabled? Is there some sort of work around to have it display? Or is it marked as some future feature request?
This is a very difficult problem to solve, the syntax highlighting code is very complex and was written by someone who no longer contributes to the Templater project. I don't know when this will be fixed.
For now, I suggest disabling syntax highlighting for Templater if you are affected by this issue. Or only enabling it when you're working on A template and disabling it when you're done.
Ok thanks, I was just curious is all.
Plugin information (please complete the following information):
data.json
belowDescribe the bug When I have Templater's syntax highlighting enabled, If I have a markdown codeblock containing code with the same opening and closing tags, then Templater improperly applies syntax highlighting to these lines.
Example code block demonstrating an ERB Template fragment (Ruby on Rails):
Templater will apply syntax highlighting to the second line.
Second Example:
Expected behavior A clear and concise description of what you expected to happen.
Templater should not highlight lines within a markdown codeblock
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.