sphinx-doc / sphinx-doc/sphinx

napoleon_custom_sections add css class with section name

Open
#9,526 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extensions:napoleon type:enhancement
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Hi, there are two display styles of napoleon_custom_sections - params_style and return_style.

My issue is that in return_style if i use python dictionary in it, on first key value pair the dot is replaced with two dashes (otherwise do exactly what i want)

Untitled

If i use just custom section not as tuple, but just as list, then it's not formatted.

Untitled2

I could use own CSS, but problem is, that i cannot identify what my section is.

I understand that it's not possible to add more and more custom sections, but is it possible to add class to the element, so i can format it?

Untitled3

So in last image there is extra class with name of my section so i can use it in my CSS as .rubric .mysection

Contributor guide

Open the contributing guide

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 tracing the napoleon_custom_sections handling for return_style and params_style, then inspect how custom sections are rendered into HTML. Confirm the desired behavior from the examples: a section-specific CSS class should be present so selectors such as .rubric .mysection can target it without changing existing formatting.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.