If some rules about naming files are ensured (eg. by path [folder]/en-US/some-markdown-file.md or by file [folder]/some-markdown-file.en-US.md), something very common in software development, it will be easier use this plugin with zero config.
Proposal
Add a new config parameters to enhace it.
Draft:
"language-resolver": null: a regex pattern or a function to extract the lang slug using visited tree/file info.
"default-language": "en-US": fallback language, when is not supported by Intl webapi or other Collator package.
Use remark-frontmatter plugin could be the best option to extract this info if some microblogging static generators like Jekyll, Hugo, ... are used in the project. So... another param??
Defeat
Having a merelly
{ language: "your lang" }
as config object is a bit simple when remark is applied in a multilanguage project.https://github.com/vhf/remark-lint-alphabetize-lists/blob/ee5f968040acf941c9c4d61fefb2bb1e3b1e8a7b/lib/alphabetical-list-items.js#L17
If some rules about naming files are ensured (eg. by path
[folder]/en-US/some-markdown-file.md
or by file[folder]/some-markdown-file.en-US.md
), something very common in software development, it will be easier use this plugin with zero config.Proposal
Add a new config parameters to enhace it.
Draft:
"language-resolver": null
: a regex pattern or a function to extract the lang slug using visited tree/file info."default-language": "en-US"
: fallback language, when is not supported byIntl
webapi or other Collator package.Use
remark-frontmatter
plugin could be the best option to extract this info if some microblogging static generators like Jekyll, Hugo, ... are used in the project. So... another param??"use-frontmatter": true
An example of
language-resolver
can be found at fpb-lint-cli: https://github.com/vhf/free-programming-books-lint/blob/b72812e3cf51e0dce322a30d465f50ee618f3d0c/lib/lint.js#L59-L70