file-explorer-markdown-titles icon indicating copy to clipboard operation
file-explorer-markdown-titles copied to clipboard

fix indent when filename is not simple letter or digit

Open Kolossi opened this issue 2 years ago • 1 comments

If a filename contains anything other than a letters or digits - such as space or underscore - or even if it has letters and digits, the indenting gets mashed up in file view.

The regex incorrectly counts only groups of letters or groups of digits to find indent level.

This fix sorts that out by changing the regex to look for groups of chars which are anything except / or \.

I'm a dev but not done an obsidian plugin before, so unclear how to make and test a new plugin. But tested the regex by hacking the main.js in my .obsidian\plugins\file-explorer-markdown-titles dir.

It turned this (note indent level matches number of spaces in filename which matches first title)

image

into this:

image

As desired! I don't claim to have exhaustively tested this change however :-)

NOTE : I do know the plugin is kinda pointless on files named like above where filename matches first title, but they are in a directory in my vault made as part of an import, and I'd still like it to look ok in the file view as I really need and appreciate the plugin for my new notes which use zettelkasten-style filenames.

Kolossi avatar Dec 02 '22 22:12 Kolossi

Applied these changes locally and they're working as expected for me. Would definitely love to see this merged and released as a proper plugin update!

b-turchyn avatar Feb 16 '23 13:02 b-turchyn