I have seen several people asking here for a tab not to convert text into a code block in Obsidian. I understand from the answers they have received that this is inherent to markdown, so not something that can be changed in Obsidian.
As I understand it, code blocks cannot contain “mentions” (either linked or unlinked).
What I’m trying to do
I want to convert all code blocks in the whole graph (~2,000 .md files) into bullet lists.
I want text within code blocks to register as “mentions” (both linked and unlinked).
Two months ago I imported two years’ worth of notes from Roam (yes, I know, I should have moved earlier). All of my notes (~2,000 files) were formatted in Roam (bullet points on everything, tabs used to indent blocks of text).
I do not write code (my work is not tech-related) so I have only now realised that Obsidian is viewing all of my indented text as code blocks. This would just be a formatting problem for me except that all of my “mentions” in indented blocks that previously worked in Roam will no longer appear as “mentions” in Obsidian. This means I’m losing a large percentage of the linking/mentioning functionality.
If anyone has any suggestions for solving this in a relatively automated manner (bearing in mind I’m sadly ignorant of coding matters) that’d be much appreciated. Otherwise It’s going to take me months to go through all my notes reformatting them and in the meantime my links aren’t working.
Getting Obsidian to allow code blocks to register as mentions I don’t think is going to happen. Maybe there does exist some plugins/tools to convert Roam data into something more useful for Obsidian, but I’m not familiar with Roam to suggest some.
On the other hand, converting into bullet lists might not be that hard to do if you use something like Visual Studio Code, and do a global search-and-replace on the white-space into list marking.
So I would research a little more as to how other users have done this transformation, and possibly install Visual Studio Code to prepare for a massive search-and-replace.
To help with such a search-and-replace, we would also need to see some actual code as to how your source text looks like, and some of the variations which might occur. Preferably both with the original data, and how you would like it to look afterwards.
I have since discovered that Obsidian does recognise text as text when it is indented multiple times and does not follow a heading line. The moment I add a heading line to a file, the text below it that is indented once will switch to being code (and backlinks within it will no longer be recognised as such).
Thankfully, that means that most of my links can continue to work so long as I don’t add heading lines to the files. Once I add headings though, I need to manually un-indent all the text.
So there’s a steady task ahead of me, manually reformatting two years’ worth of notes. I do however trust my ability to do that over my ability to learn Visual Studio Code.
To speed up your manual indenting you could select all (Cmd/Ctrl+a) and unindent (Cmd+[ on Mac; not sure about Windows).
If you’re on Windows and it doesn’t have a keyboard shortcut for unindent, you can use Obsidian’s in-page find-replace — just copy the indentation and replace it with nothing (I don’t k if it’ll work if the indentation is a tab).