sphinx-lint
sphinx-lint copied to clipboard
Check for underscores used instead of stars for emphasis
While Markdown allows both _emphasis_ and *emphasis*, reST only has *emphasis*. On this page of the packaging user guide, someone apparently thought underscores would work: https://packaging.python.org/en/latest/specifications/name-normalization/
FrIeNdLy-._.-bArD(a _terrible_ way to write a name, but it is valid)
This might get tricky, since there are several cases that are ambiguous, especially when the emphasis includes multiple words. I guess we could detect and mark something like \b_[^_]+_\b as errors (even though there might show up in expressions like ``res = _var_ + 1``) and ignore emphasis spanning multiple words.
Another option is to make the checker more comprehensive, but make it optional, since the risk of false positive becomes higher.