sphinx-doc / sphinx-doc/sphinx-argparse

Smart quotes rewrites --option mentions in help text as an en dash

Open
#100 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
38
Forks
33
PR merge metrics
No merged PRs in 30d

Description

With Sphinx's default smartquotes = True, any --option mentioned in a help string, description, or epilog renders as –option (en dash), so the documented text no longer matches what the command line accepts. The generated option names are unaffected (they are literals) - only mentions inside help text.

You can see this bug in the wild in quite a lot of places, here's one - https://kafka-python.readthedocs.io/en/master/cli/consumer.html: The file owns handlers/formatters, so –log-format, –log-date-format and –log-file are ignored, but –enable-logger and –disable-logger still apply as logger level adjustments.. I discovered this in one of my own projects, but am currently working around it like this: https://github.com/mmulqueen/pyStrich/blob/3c5a6767d1fb3a5b0b1da602fd644baf89d56e72/docs/conf.py#L351

This was previously reported as alex-rudakov/sphinx-argparse#73 (2017) and closed with only the global smartquotes = False workaround, which sacrifices typography across the whole project.

I have a patch and will submit a PR shortly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked docs/conf.py workaround and the extension's handling of help strings versus generated option names. Done means literal --option mentions remain unchanged under Sphinx smartquotes while generated option names and other typography remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.