Navigation Menu

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

More fine-grained highlighting of parameters in function signatures #6417

Closed
timhoffm opened this issue May 31, 2019 · 5 comments
Closed

More fine-grained highlighting of parameters in function signatures #6417

timhoffm opened this issue May 31, 2019 · 5 comments
Labels
domains:py type:enhancement enhance or introduce a new feature
Milestone

Comments

@timhoffm
Copy link
Contributor

Parameters in function signatures are currently parsed to a single html element such as
<em class="sig-param">myparam=4</em>

It would be nice to split this down further into classed spans, so that we could highlight different parts of the parameters separately. For example:

<em class="sig-param">
<span class="sig-param-name">myparam</span>=<span class="sig-param-value">4</span>
</em>

(line breaks only for better readability. Actual code wound not have linebreaks as they would result in whitespace in the rendered HTML.)

Things to consider:

  • This requires further splitting at the parser level.
  • Maybe even add a class for =?
  • Type annotations could be considered as well, as a separate span.

This is a follow-up on #4390/#6401 and #5868.

@timhoffm timhoffm added the type:enhancement enhance or introduce a new feature label May 31, 2019
@tk0miya tk0miya added this to the 2.2.0 milestone May 31, 2019
@tk0miya
Copy link
Member

tk0miya commented May 31, 2019

Will do.

@Thom1729
Copy link

Thom1729 commented Jun 5, 2019

Instead of em, var seems semantically appropriate.

@tk0miya
Copy link
Member

tk0miya commented Jan 4, 2020

I just made a draft PR #6990 to realize this feature. Please check it if you have time :-)

tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 4, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 4, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 4, 2020
@tk0miya tk0miya modified the milestones: 2.4.0, 3.0.0 Jan 4, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 4, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 4, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 4, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 8, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Jan 8, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 14, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 14, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 14, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 22, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 22, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 22, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 22, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 23, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 29, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 14, 2020
tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 14, 2020
@tk0miya
Copy link
Member

tk0miya commented Mar 14, 2020

Now I merged #6990. It allows you to decorate function signatures via CSS more flexibly. Could you try it please? I don't think it still does not cover the complex case like #5868. So we need to improve the output more.
Thanks,

@tk0miya tk0miya closed this as completed Mar 14, 2020
@timhoffm
Copy link
Contributor Author

timhoffm commented May 3, 2020

@tk0miya Thanks! This works for me.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
domains:py type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

3 participants