Http syntax highlighting in nested code block breaks syntax

Steps to reproduce

You need to create a nested code block and activate http syntax highlighting.
It is only possible to “end” the code section if you place the quotes at the very left of the line. But then the folding is broken.

Sorry for only posting screenshots instead of providing code snippets. But the code blocks breaks the forum post.

Expected result

The expected result is that you can place nested code blocks with http syntax highlighting without breaking the syntax that follows after the code block.

Actual result

Environment

Obsidian version: v1.4.16
Installer version: v1.4.16
Operating system: Arch Linux

I’m moving this to Help because it appears you just need some advice on how to syntax things properly. I’m seeing some of your backticks in an indented block. But like you said, it will really be necessary to see your actual code.

In the forum to include code blocks use 4 backticks to surround 3 backticks. Like this:

````
```
Your code example here
```
````

To demonstrate 4 backticks to you, I’m using 5 backticks to surround my 4 backticks to surround my 3 backticks! Like this:

screenshot_2023-12-21_03-22-31

1 Like

Thank you very much for your advice @rigmarole.

Here im presenting you the code snippet to reproduce the bug considering the http syntax highlighting in nested code blocks.
Please just insert the snippet in Obsidian and take a look at the broken output.

- My http requests
	- My http request 1 (works without http syntax highlighting)
		```
		GET / HTTP/1.1
		Host: www.google.com
		```
	- My http request 2 (also works but can not fold properly)
		``` http
		GET / HTTP/1.1
		Host: www.google.com
```
	- My http request 3 (folding works properly , but breaks syntax that comes after this section)
		``` http
		GET / HTTP/1.1
		Host: www.google.com
		```
	- My http request 4 (my syntax is broken)
1 Like

Ok, I see what you mean now. I have made a gif showing that it is specifically the “http” or “HTTP” format tag that seems to change the way the formatting works. You said that, but I didn’t realize what you meant until I saw it in Obsidian, pardon.

I’ll move this back to Bugs.

If you have any other syntax tag, like “python”, or nothing, then it seems to work.

I also tested with blank lines above and below the code block as described in this discussion. And it made no difference.

httpCodeBlock

1 Like

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