Benature/obsidian-text-format

Add support for Remove Force Hyphens command

Sinled opened this issue · 2 comments

Hi, thanks for great plugin.

Would it be possible to add new command for removing hyphens? I often have hyphens where should be non when copying text from pdfs, something like this:

Lorem Ipsum  is si- mply dummy text of the printing and types- etting industry. Lorem Ipsum has been the industry's st...

usually i replace it in another text editor with regxep /(\w)-[ ]/ but it's not very convenient, and obsidian command will be more useful.

supported in v1.5.3

Hi. There's an issue in the current implementation of this feature.

case "hyphen":
        replacedText = selectedText.replace(/(\w)-[ ]/g, "");

It should replace with "$1", not with an empty string. Otherwise, the character before the hyphen is lost. Using the example from the original comment:

> "si- mply".replace(/(\w)-[ ]/g, "$1")
'simply'
> "si- mply".replace(/(\w)-[ ]/g, "")
'smply'