You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently MD040 lets you set allowed_languages, but that's not a good fit if you only want to disallow a couple of specific languages. Adding a disallowed_languages parameter could handle that case. Should probably only allow one of those parameters or the other, but not both, since they're contradictory.
Bonus points if disallowed_languages could be a string[] or a mapping of languages to their preferred alternative, e.g.:
I like the idea of providing alternate suggestions, though that could be incorporated into the current implementation. I'm curious why you think it's easier to exclude languages? In the proposed model, someone could accidentally use the identifier "javasript" and it would be okay unless you specifically blocked that in advance. Because the list of valid languages is so small, an allow list (like the current implementation) seems safer?
In projects with a large amount of docs covering a wide range of topics (doing a quick count, the Electron docs would need to add 16+ languages to the allow list), I'd personally prefer using a disallow list as it is easier for new contributors who might be introducing a code block with a new language identifier. Usually linting failures just require you to modify your own added content to fix them, but with the allow list a contributor would need to find and understand the markdownlint configuration to update the allow list, which requires a bit more technical knowledge than a contributor adding to Markdown docs may have.
So for me I'd prefer to not add an additional potential barrier to entry for contributors, at the cost of potentially letting errors slip in (like your very valid "javasript" example). I can deal with the latter out-of-band without blocking contributors, and use the disallow list to still cover it 90% of the time (outright typos aren't very common compared to using javascript vs js, etc).
I think there's value in having both options supported, but I can understand if you'd prefer to keep it simpler for maintenance reasons.
Currently MD040 lets you set
allowed_languages
, but that's not a good fit if you only want to disallow a couple of specific languages. Adding adisallowed_languages
parameter could handle that case. Should probably only allow one of those parameters or the other, but not both, since they're contradictory.Bonus points if
disallowed_languages
could be astring[]
or a mapping of languages to their preferred alternative, e.g.:would produce an error telling the user to use
javascript
instead ofjs
as the language identifier.The text was updated successfully, but these errors were encountered: