From 06e6bd7232a80a56200d0db60e15123b04b980f1 Mon Sep 17 00:00:00 2001 From: souradeep-das Date: Wed, 18 Jun 2025 15:22:35 +0200 Subject: [PATCH 1/2] feat: add ui to reflect section links --- src/docc/plugins/html/static/docc.css | 24 +++++++++++++++++++ .../python/templates/html/attribute.html | 7 +++++- .../plugins/python/templates/html/class.html | 9 ++++++- .../python/templates/html/function.html | 9 ++++++- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/docc/plugins/html/static/docc.css b/src/docc/plugins/html/static/docc.css index 205d7d4..d83f164 100644 --- a/src/docc/plugins/html/static/docc.css +++ b/src/docc/plugins/html/static/docc.css @@ -292,3 +292,27 @@ details[open] > summary::after { .hi-call > .hi-attribute > .hi-name:last-child { font-weight: bold; } + +.header-anchor a { + color: inherit; + text-decoration: none; +} + +.header-anchor a:visited { + color: inherit; +} + +.header-anchor .link-logo { + visibility: hidden; + margin-left: 0.2em; + text-decoration: none; + color: #888; + font-weight: normal; + cursor: pointer; + transition: color 0.2s; +} + +.header-anchor:hover .link-logo, +.header-anchor:focus-within .link-logo { + visibility: visible; +} \ No newline at end of file diff --git a/src/docc/plugins/python/templates/html/attribute.html b/src/docc/plugins/python/templates/html/attribute.html index e065041..329c30d 100644 --- a/src/docc/plugins/python/templates/html/attribute.html +++ b/src/docc/plugins/python/templates/html/attribute.html @@ -17,7 +17,12 @@

{% for name in node.names %} - {{ name|html -}} + + {% reference name.full_name %} + {{ name|html -}} + + {% endreference %} + {%- if not loop.last %}, {% endif %} {% endfor %}

diff --git a/src/docc/plugins/python/templates/html/class.html b/src/docc/plugins/python/templates/html/class.html index e1f9aac..67956e3 100644 --- a/src/docc/plugins/python/templates/html/class.html +++ b/src/docc/plugins/python/templates/html/class.html @@ -15,7 +15,14 @@ # along with this program. If not, see . -#}
-

{{ node.name|html }}

+

+ + {% reference node.name.full_name %} + {{ node.name|html }} + + {% endreference %} + +

{% if node.docstring %}
diff --git a/src/docc/plugins/python/templates/html/function.html b/src/docc/plugins/python/templates/html/function.html index ccd9a3e..5433896 100644 --- a/src/docc/plugins/python/templates/html/function.html +++ b/src/docc/plugins/python/templates/html/function.html @@ -15,7 +15,14 @@ # along with this program. If not, see . -#}
-

{{ node.name|html }}

+

+ + {% reference node.name.full_name %} + {{ node.name|html }} + + {% endreference %} + +

{% if node.docstring %}
{{ node.docstring|html }} From a5777b1c17398e68e6bba44eeae9c6ae130e7189 Mon Sep 17 00:00:00 2001 From: souradeep-das Date: Wed, 18 Jun 2025 15:23:29 +0200 Subject: [PATCH 2/2] style: add newline --- src/docc/plugins/html/static/docc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docc/plugins/html/static/docc.css b/src/docc/plugins/html/static/docc.css index d83f164..cc003f4 100644 --- a/src/docc/plugins/html/static/docc.css +++ b/src/docc/plugins/html/static/docc.css @@ -315,4 +315,4 @@ details[open] > summary::after { .header-anchor:hover .link-logo, .header-anchor:focus-within .link-logo { visibility: visible; -} \ No newline at end of file +}