Closed settermjd closed 4 years ago
Hey, thanks for the issue! I don't think it's possible to do this with spellchecker-cli
, unfortunately. Dictionaries are intended to ignore single words, not longer blocks of text.
I think the correct solution would be to have special parsing for AsciiDoc files and ignore code blocks in them automatically.
I have a similar issue with hugo flavored markdown files. I would like to exclude short codes e.g. {{.*}}
to ignore short codes like {{< highlight Yaml "linenos=table" >}}
.
For me it makes sense to only allow single words in a dictionary file but what about the ignore
cli flag? Or could we simply add something like --ignore-raw
flag?
Thanks for the report! OK, I think it might make sense to add some way to exclude larger chunks of text from files before spellchecking. First, how are you working around this issue currently? I'm guessing you've added the words you want to ignore to a dictionary file?
Yes I have not found a better workaround and simply added the words to the dict. Ok for the Yaml
example I currently use a simple regex like (Y|y)aml
but yeah, actually not really what I want :)
Another possible solution that comes to my mind are HTML comments, like markdownlint handles block excludes e.g.
<!-- spellchecker-disable -->
{{< highlight Shell "linenos=table" >}}
# some code
echo "Hello World"
{{< /highlight >}}
<!-- spellchecker-enable -->
See https://github.com/DavidAnson/markdownlint#configuration
I like the idea of using HTML comments to disable the spellchecker for certain parts of a Markdown file. I'd definitely accept a PR to add that functionality! I don't know if I'll get to implementing it myself. I might look into it this weekend if I have time.
In the documentation, it says that any regexes are automatically surrounded with
^
&$
. However, I need to use the following regex/(\[source,[a-z]+\])(\n\.{4}[\s\S]*?\.{4})/g
, as it is, to match the two source blocks in the following AsciiDoc snippet.Is this possible?