Question about tag management in Obsidian vaults

My first posting in this forum; hello everyone. On balance it seems like Meta is the best topic for this question, but please redirect me if not.

I have begun to build a new vault based on a large accumulated library of information from SOHO Notes, DEVONthink and other freeform note-taking tools. It’s going well so far, but I’ve hit a bump when looking at tags. I would be interested to understand how people manage the different ways in which the hash symbol is used in incoming text, and how to ensure that Obsidian treats them appropriately.

It looks like Obsidian uses a hash followed immediately by a word to denote a tag for the content. A lot of the files that I’m importing are sourced from code, where a hash is often used as a comment. I don’t want Obsidian to create a whole load of tags (like #LoadModule, for example) for things that are not tags. I can work out how to delete the unwanted hash symbols wholesale from all of the files in the folders. Also, this would in effect remove the comments from my code, which is also not ideal. Is there a good way to achieve what I want to do here?

Select all notes that use # as a comment
Find and replace # with your preferred comment syntax in Obsidian.
Personally, I’d do it outside of Obsidian.

Just put your code blocks into ``` tags like this:

tags: [test, code]

This is a #testtag.

# A simple Perl example
#not #a #tag
my $s = "Wikipedia"; # Sets the variable s to "Wikipedia".
print $s . "\n";     # Add a newline character after printing

You even get code highlighting for many languages, and Obsidian will not interpret tag-like constructs in code blocks.

In this example, Obsidian will add

  • #test
  • #code
  • #testtag

to its list of tags.

Thanks for the answers; that has helped to clarify things somewhat. I have now done a rough clean-up of the imported documents to remove the non-tags, and now I can start building tags and linking documents properly.

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