Closed ThierryO closed 2 years ago
Thank you for the contribution. This is a very big PR, I am not sure where to start reviewing this.
Could perhaps (part of) this work as a separate package which depends on spelling
? Or does it really need to change the internals of spelling
?
Maybe it is easier for you if I split this over multiple PR's.
This functionality makes spelling
IMHO even more useful. I don't think the users would benefit from a 'competing' spell checking package.
This is PR adds a lot a functionality to
spelling
. Basically because I needed a easy way to spell R markdown projects. We often use multiple languages in a single project. E.g. a report written in Dutch with an English abstract and README. Or a package with function and documentation in English and a report template in Dutch.I'm happy to do some more work on this PR if you want some more streamlining.
Changes
lang
variable and displays the language used for spell checking.spell_check_project()
to check a project with (R)markdown filesspell_check.json
to store the language information. Single language packages relay on the information fromDESCRIPTION
.change_language()
allows to set a non-default language for files or folders (and their childern). UpdateDESCRIPTION
to change the default language of a package. Usespell_check_project()
with thelang
argument to set or change the default language of markdown project.change_language(lang = "ignore")
will ignore a file or folder when spell checking.parse_text_md()
tries to ignore math and yaml field names. It also ignore lines containing<!-- spell-check: ignore -->
or lines between<!-- spell-check: ignore:start -->
and<!-- spell-check: ignore:end -->
. This was required to ignore some more elaborate math examples whichcommonmark::markdown_xml()
split over multiple lines.spell_check_package()
gains aninst = FALSE
argument. Settinginst = TRUE
will include markdown and sweave files in theinst
folder. I'd prefer to useinst = TRUE
as default, but that might change the spell check results for some packages.inst/WORDLIST
both for packages and projects. Alternative languages use the normalised language as suffix. E.g.inst/WORDLIST_nl_BE
.Tested with