I have a block of code (it’s actually a copy of a portion of my smb.conf file) that I want to store in a howto section of Obsidian. For the life of me I can’t work out any easy way of doing it. The problem seems to stem from it having ‘#’ characters as comments in the line which are being translated as markup, even in a “Code” section.
Things I have tried
For example, copy the following.
#########
# Comment
#########
Then in an obsidian node, right click select “Code” which pops a couple of single quotes into the editor, then paste in the code above. It comes out looking like the following. Surely a code block should not be processing markup?
Given your screenshot and the fact that the last backtick (`) appears just after some amount of #, I don’t think your code block is well formatted
I mean, It should look something like (in Source):
```
#########
# Comment
#########
```
… But here, the closing backtick appears just after the last # on the last line.
So, this makes me believe that you potentially chose the option toggle code in the command palette and got an “inline code” (which can only be used, well, inline … without line breaks) within which you pasted your content instead of Insert code block, which would give you a multiline code block in which pasting your content seems to work .
Edit: If you want to use the right-click context menu, you should look for Insert > Code Block (as opposed to Format > Code )