Closed nfelt14 closed 2 months ago
Hey @nfelt14, thanks for the request :slightly_smiling_face:
I agree that it would be nice to be able to ignore files based on globs on regex. Would you like to submit a PR? If you want to go with globs, which I'd prefer, here's how I did it in another project:
def _expand_inputs(self, inputs: list[str], page_uris: list[str]) -> list[str]:
expanded: list[str] = []
for input_file in inputs:
if "*" in input_file:
expanded.extend(fnmatch.filter(page_uris, input_file))
else:
expanded.append(input_file)
return expanded
def on_files(self, files: Files, *, config: MkDocsConfig) -> Files | None: # noqa: ARG002
for manpage in self.config.pages:
manpage["inputs"] = self._expand_inputs(manpage["inputs"], page_uris=list(files.src_uris.keys()))
return files
This code should be updated to fit mkdocs-spellcheck configuration of course :slightly_smiling_face:
The advantage of this approach is that we don't read the disk, and rather use the file objects collected by MkDocs, therefore supporting dynamically generated files that don't even exist in the docs folder.
If I can find the time to work on it, I will let you know.
@pawamoy I was able to get a PR up for this.
@pawamoy, any idea when a new release with this feature will be available?
Later today 👍
v1.1.0 released :slightly_smiling_face:
Is your feature request related to a problem? Please describe.
I have a lot of auto-generated API documentation files that contain lots of words that get flagged as spelling errors, but really should be ignored.
Describe the solution you'd like
I would like to be able to specify a glob or regex to ignore groups of files when spellchecking.
Describe alternatives you've considered
The only workaround is to list each and every file in the
skip_files
option list, but I am dealing with 600+ files that may need to be ignored.