diff --git a/numpydoc/docscrape_sphinx.py b/numpydoc/docscrape_sphinx.py index 087ddafb..c3e21c08 100644 --- a/numpydoc/docscrape_sphinx.py +++ b/numpydoc/docscrape_sphinx.py @@ -67,12 +67,8 @@ def _str_extended_summary(self): return self['Extended Summary'] + [''] def _str_returns(self, name='Returns'): - if self.use_blockquotes: - typed_fmt = '**%s** : %s' - untyped_fmt = '**%s**' - else: - typed_fmt = '%s : %s' - untyped_fmt = '%s' + typed_fmt = '**%s** : %s' + untyped_fmt = '**%s**' out = [] if self[name]: @@ -127,7 +123,10 @@ def _process_param(self, param, desc, fake_autosummary): relies on Sphinx's plugin mechanism. """ param = param.strip() - display_param = ('**%s**' if self.use_blockquotes else '%s') % param + # XXX: If changing the following, please check the rendering when param + # ends with '_', e.g. 'word_' + # See https://github.com/numpy/numpydoc/pull/144 + display_param = '**%s**' % param if not fake_autosummary: return display_param, desc diff --git a/numpydoc/tests/test_docscrape.py b/numpydoc/tests/test_docscrape.py index 2fb4eb5a..56f5f5a5 100644 --- a/numpydoc/tests/test_docscrape.py +++ b/numpydoc/tests/test_docscrape.py @@ -484,24 +484,24 @@ def test_sphinx_str(): :Parameters: - mean : (N,) ndarray + **mean** : (N,) ndarray Mean of the N-dimensional distribution. .. math:: (1+2+3)/3 - cov : (N, N) ndarray + **cov** : (N, N) ndarray Covariance matrix of the distribution. - shape : tuple of ints + **shape** : tuple of ints Given a shape of, for example, (m,n,k), m*n*k samples are generated, and packed in an m-by-n-by-k arrangement. Because each sample is N-dimensional, the output shape is (m,n,k,N). :Returns: - out : ndarray + **out** : ndarray The drawn samples, arranged according to `shape`. If the shape given is (m,n,...), then the shape of `out` is (m,n,...,N). @@ -509,26 +509,26 @@ def test_sphinx_str(): In other words, each entry ``out[i,j,...,:]`` is an N-dimensional value drawn from the distribution. - list of str + **list of str** This is not a real return value. It exists to test anonymous return values. - no_description + **no_description** .. :Other Parameters: - spam : parrot + **spam** : parrot A parrot off its mortal coil. :Raises: - RuntimeError + **RuntimeError** Some error :Warns: - RuntimeWarning + **RuntimeWarning** Some warning .. warning:: @@ -596,13 +596,13 @@ def test_sphinx_yields_str(): :Yields: - a : int + **a** : int The number of apples. - b : int + **b** : int The number of bananas. - int + **int** The number of unknowns. """) @@ -1129,10 +1129,10 @@ def no_period(self): :Parameters: - f : callable ``f(t, y, *f_args)`` + **f** : callable ``f(t, y, *f_args)`` Aaa. - jac : callable ``jac(t, y, *jac_args)`` + **jac** : callable ``jac(t, y, *jac_args)`` Bbb. .. rubric:: Examples @@ -1141,10 +1141,10 @@ def no_period(self): :Attributes: - t : float + **t** : float Current time. - y : ndarray + **y** : ndarray Current variable values. * hello @@ -1153,10 +1153,10 @@ def no_period(self): :obj:`an_attribute ` : float Test attribute - no_docstring : str + **no_docstring** : str But a description - no_docstring2 : str + **no_docstring2** : str .. :obj:`multiline_sentence ` @@ -1190,10 +1190,10 @@ def test_templated_sections(): :Parameters: - f : callable ``f(t, y, *f_args)`` + **f** : callable ``f(t, y, *f_args)`` Aaa. - jac : callable ``jac(t, y, *jac_args)`` + **jac** : callable ``jac(t, y, *jac_args)`` Bbb. """)