What I’m trying to do
I have a code block
```bash
git log \
--graph \
--abbrev-commit \
--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
```
…and then some regular text below.
Because of the <%
in the last line the Live Preview mode renders the regular below this code blocks as if it’s part of the code block.
If I switch to Reading View the Markdown rendering is correct.
Things I have tried
surround the code block with <code>
tags instead of triple backticks
ariehen
February 15, 2024, 10:23pm
2
Please follow and include the entire template when submitting bug reports. Thanks.
Your exact code block looks alright over here in both Live Preview and Reading view (Obsidian v1.5.3).
I can’t reproduce. post a screen recording of this happening in the sandbox vault.
cocon
February 18, 2024, 10:29am
4
I have the same problem.
Perhaps it comes from this issue but I have no knowledge to fix it…
opened 06:33PM - 24 Sep 23 UTC
bug
<!--
Hey there, thanks for creating an issue!
In order to reproduce your iss… ue, we might need to know a little bit more about the environment
which you're running `Templater` on.
-->
**Plugin information (please complete the following information):**
- OS: MacOS 13.5.2 (22G91)
- Templater version: 1.16.0
- Obsidian version: 1.4.13
- Templater settings: see `data.json` below
```
{
"command_timeout": 5,
"templates_folder": "00 Meta/templates",
"templates_pairs": [],
"trigger_on_file_creation": true,
"auto_jump_to_cursor": true,
"enable_system_commands": false,
"shell_path": "",
"user_scripts_folder": "00 Meta/scripts",
"enable_folder_templates": true,
"folder_templates": [
{
"folder": "/",
"template": "00 Meta/templates/template - meta.md"
}
],
"syntax_highlighting": true,
"enabled_templates_hotkeys": [
""
],
"startup_templates": [
""
],
"enable_ribbon_icon": true
}
```
**Describe 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):
```erb
# file: app/views/records/index.html.erb
<%= render partial: "records/records" %>
```
Templater will apply syntax highlighting to the second line.
Second Example:
```erb
# file: app/views/records/index.turbo_stream.erb
<%= turbo_stream.update(@frame_id) do %>
<%= render partial: "records/records" %>
<% end %>
```
- Templater applies syntax highlighting to all three matching lines
- The first and third matches will have improper indentation breaking the codeblock styling
**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.
<img width="766" alt="templater-example-bug" src="https://github.com/SilentVoid13/Templater/assets/5733437/3dbb162e-84b8-4b26-a193-d6906181beef">
**Additional context**
Add any other context about the problem here.
1 Like
ariehen
February 18, 2024, 10:47am
5
Yeah, it seems like a Templater issue.
1 Like
Yes that seems to be it, thank you!
I think I’ve found the relevant issue on the Templater repo .
Disabling Templater’s setting “Syntax Highlighting on Desktop” renders the note as I want it to, at the cost of not having syntax highlighting for Templater templates of course.
system
Closed
March 1, 2024, 2:26pm
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.