Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom label for code-block captions (Output 1.2 / Input 1.2 / Source 1.4 / Directory tree 1.2 / etc) #6642

Open
jonascj opened this issue Aug 14, 2019 · 0 comments
Labels
type:enhancement enhance or introduce a new feature

Comments

@jonascj
Copy link

jonascj commented Aug 14, 2019

Is your feature request related to a problem? Please describe.
Although Listing 1.2 is used in English literature for both source code listing, pseudocode, programoutput, console sessions etc. I would often prefer to use "Output 1.2" when listing output, "Source 1.2" when listing source code etc.

I refer to the Listing in Listing 1.2 as the caption label. This might be the wrong terminology, I don't know. It is of course not to be confused with labels used with references.

Describe the solution you'd like
Input:

.. code-block::
  :caption: Output of nested loop.
  :caption-label: Output

  $ python -V
  Python 3.7.4

Output: Output 1.2: Output of nested loop.

Screenshot of proposed output

Although not the prettiest, the code-block counters could be kept as they were, i.e. no matter the :caption-label: they would use the same counter producing what is in the screenshot.
I suppose the optimal thing would be to use separate counters for each :caption-label:.

Describe alternatives you've considered
I suppose one could use / create special extensions for each use case, extensions which would provide new directives like .. output-block::. This would be semantically pretty, but also a bit overkill in my view, after all it is just a label for the caption, it is not like the block itself should be rendered differently.

@jonascj jonascj added the type:enhancement enhance or introduce a new feature label Aug 14, 2019
@AA-Turner AA-Turner added this to the some future version milestone Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

2 participants