retextjs / retext-spell

plugin to check spelling
https://unifiedjs.com
MIT License
73 stars 16 forks source link

Ignore URLs? #10

Closed cfreeley closed 7 years ago

cfreeley commented 7 years ago

Hello, I've been using this (and a number of your other retexts!) and it's been working great except sometimes the strings in question have URLs in them which always get flagged. I'm not sure if this is a problem that I should handle on my end (and if so, I would love any advice you have), but if you think it would be useful, perhaps there could be an 'ignoreURL' or even 'ignoreRegex' option?

Perhaps you could use something like https://www.npmjs.com/package/valid-url if you were to add this in.

wooorm commented 7 years ago

Is there a reason why you’re not using remark or rehype as a base? If your text contains links, it may just be markdown, and you could us remark/remark-retext/retext, like in this example: https://github.com/unifiedjs/unified#programming-interface

wooorm commented 7 years ago

@cfreeley Any thoughts on this?

cfreeley commented 7 years ago

It's not markdown, but I do understand your point- text is text, so the special cases should probably be made with that in mind. It's just with my use case, people will sometimes put just a URL, or an email address, or something, inside these documents that are all text 99% of the time. So I wasn't sure where the best place to resolve this was.

wooorm commented 7 years ago

You could use remark, and only enable some of the rules? I laid that out in https://github.com/wooorm/remark/issues/248. I think that may be the best solution

There used to be a plugin for this: retext-link, but I felt it was weird to combine syntax with natural language.

Let me know if you’ve got further questions!