sphinx-lint icon indicating copy to clipboard operation
sphinx-lint copied to clipboard

Check for underscores used instead of stars for emphasis

Open jeanas opened this issue 2 years ago • 1 comments
trafficstars

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)

jeanas avatar Nov 04 '23 20:11 jeanas

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.

ezio-melotti avatar Nov 04 '23 20:11 ezio-melotti