How to reproduce original GMT arguments in PyGMT documentation
See original GitHub issueDescription of the desired feature
The GMT documentation has many instances where bold and italicized fonts are mixed, looking something like:
+nargs
The PyGMT documentation has been rather inconsistent with this (see mentions at https://github.com/GenericMappingTools/pygmt/pull/525#discussion_r454414687 and https://github.com/GenericMappingTools/pygmt/pull/620#discussion_r493088431).
What we should do is to standardize how we want +n args to be written in the documentation. This is a bit complicated, but boils down to (at least) two options:
-
r" **+n**\ *args* ". Use a raw-string in Python, allowing us to follow upstream GMT (as per https://github.com/GenericMappingTools/pygmt/pull/620#discussion_r493088431) -
" **+n**\\ *args* ". Use a double-backslash to avoid the flake8 errorW605 invalid escape sequence '\ '.
An alternative would be to find a way to ignore the flake8 error somehow for the ReST docstrings.
Also, should we find a way to put these in code-formatted blocks (i.e. with backticks), as mentioned at https://github.com/GenericMappingTools/pygmt/pull/525/files#r454746311?
Are you willing to help implement and maintain this feature? Somewhat short on time, but will look into it.
References:
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (25 by maintainers)

Top Related StackOverflow Question
Moving forward is seems that the GMT documentation will be going with “[Default is …]” (see https://github.com/GenericMappingTools/gmt/pull/4834).
As pointed out by @weiji14, the PyGMT documentation is inconsistently using italics, bold, and
codestrings.I think we can following these conventions:
codefor Python function parametersThis is a good example of what it looks like (https://www.pygmt.org/dev/tutorials/frames.html):