Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refusing to process one example in docs #12

Closed
aubreyz opened this issue Jul 8, 2022 · 4 comments
Closed

Refusing to process one example in docs #12

aubreyz opened this issue Jul 8, 2022 · 4 comments

Comments

@aubreyz
Copy link

aubreyz commented Jul 8, 2022

This is a fantastic plugin - thank you so much for writing it

I have one curious anomaly

All my own regexes work fine, and all the other examples work fine, but one example in the docs throws up an error. It is this one.
Whatever I do it says "which contains 0 regex replacements" and does nothing at all. I wondered whether one of the characters might be a unicode character that is not what it seems, so retyped it from scratch, but no matter what I do this attempt to pre-pend something to lines (from the docs) does not work

"^(.+)$"->">$1"

@aubreyz
Copy link
Author

aubreyz commented Jul 8, 2022

OK I located the bug - there seems to be some issue if the regex files are created with windows notepad and/or the index./txt file is edited with windows notepad. If that is done then the newly created rules are "found" but do not work (even though the files look ostensibly identical and obsidian is restarted).

Perhaps something to do with line break format in these files?

Creating the identical rule within the inbuilt editor works fine
Take a look at the two attached identical looking files in the zip. The one called

prefix a2 -- works fine
prefix a -- does not work

The latter was created with windows inbuilt notepad.exe and says it is Windows-1252
The former was created with the inbuilt editor aftre pressing + and says it is ISO-10646-UCS2-BOM-WIN

prefix a.zip

@No3371
Copy link
Owner

No3371 commented Jul 9, 2022

I opened the files with VSCode and it shows UTF8, UTF16LE, which seems match the result only the first works.
Anyway, I'm afraid that my answer would be just make sure it's UTF8. The plugin use read API provided by Obsidian and we have no control over the process.

@aubreyz
Copy link
Author

aubreyz commented Jul 9, 2022

Yes. I think it probably needs a line in the documentation to point this out - because the error report does not immediately lead one to the problem and it took a long time to figure this out. Probably would also be good when the thing flashes up to say what processing has been done, if the number of regexes in the file is zero, it might hint as to a possible cause (is file in UTF-8 format).

Especially because the nature of the plugin is that an external editor is likely to be used.

@No3371
Copy link
Owner

No3371 commented Jul 12, 2022

As this does not seem common for now, I'll mention this only in the Readme. Thanks for testing this out!

@No3371 No3371 closed this as completed Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants