Benature / obsidian-text-format

Format seleted text in Obsdidian.md
MIT License
168 stars 16 forks source link

[FR] remove illegal charaters from a file name #98

Open srustamo opened 4 weeks ago

srustamo commented 4 weeks ago

Feature Description

I use Obsidian for note-taking in my research.

To keep things organized, I name each note file after the article it's based on. However, many article titles contain characters like colons (:) or pipes or sqare brackets or hash signs, that aren't allowed in filenames.

When I press Enter after pasting the title, Obsidian automatically changes it to "untitled". This makes editing difficult, as I have to either repaste the title and edit it again, or paste it elsewhere, fix it, and then paste it back. It would be great if Obsidian could automatically remove or replace these invalid characters, so I don't have to manually fix them every time.

Ultimately, whether these characters are present in the file name or not is not a major concern for me. The main issue is the inconvenience of having to repeatedly edit the filename.

Example

Input:

#Ц5  #2комнатная  2/3/4 [кирпич] 

Result:

Ц5  2комнатная  2 3 4 кирпич    
Benature commented 2 weeks ago

For your case, modifying file name is not considered to be supported for now.

As a workaround, you can follow the steps (which is troublesome though)

  1. paste the title text in the file content
  2. Format the text with command Custom Replacement
  3. copy the result text
  4. paste in the tile

Custom Replacement: