Adding java script is okay, the issue is we do not want to make it too complex where it becomes a burden to maintain in the future. That being said a more complete solution would be to calculate the height of enums in js and if it is larger that a certain value collapse the text with a link to expand it. My javescript/css ability is limited but if someone creates a solution I can implement it into our website generator script.
ok, I’m testing this
Here is a first version:
to test it directly in the documentation generated,
you can add the script at the end of the doctools.js file.
Just after
$(document).ready(function() {
Documentation.init();
});
and changz theme_overrides.css
by:
/* Prevent Long enum lists */
.field-body {
display: block;
width: 100%;
/*REMOVED max-height: 245px;*/
overflow-y: auto !important;
}
/* Hide home icon in search area */
.wy-side-nav-search > a:hover {background: none; opacity: 0.9}
.wy-side-nav-search > a.icon::before {content: none}
/*ADDED*/
.partial-block { max-height: 245px; overflow-y: scroll !important; }
.expanded-block { max-height: none !important; }
.show-block-btn {
user-select: none;
cursor: pointer;
text-align: center;
}
.show-block-btn:hover {
text-decoration: underline;
background-color: #f0f0f0;
}
Test it if you wish. I worked with it on Chrome and Firefox and quickly tested with Edge.
(I don’t have Safari)
jmv
I referenced this here: https://developer.blender.org/T73223 so someone can look into in the future.
Hello @Blendify
Thanks for the improved documentation.
To continue in this direction, I reviewed my previous script (too complicated I admit).
Here it is very simple, it works on PC and touch screens.
This modification allows long enumeration lists to be resized and preserves the display of parameter names.
theme_overrides.css
/* T76453: Prevent Long enum lists */
.field-list > dd p {
max-height: 245px;
overflow-y: auto !important;
word-break: break-word;
}
...
modified by:
/* T76453: Prevent Long enum lists */
.field-list > dd li { /* ORIGINAL LINE: .field-list > dd p { */
max-height: 245px;
overflow-y: auto !important;
word-break: break-word;
}
/* Make long lists resizable */
.long-field-list {
max-height : unset !important;
min-height : 245px;
height: 245px;
resize: vertical;
}
/* Always show parameter names */
.long-field-list strong:first-child {
position: sticky;
display: block;
top: 0px;
background-color: white;
}
...
theme_overrides.js
New script file to add to HTML files. (But I don’t know how it’s done with Sphinx)
window.addEventListener ("DOMContentLoaded", function ()
{
// These values are defined by theme_overrides.css
const selector = ".field-list > dd li"
const max_height = 245
for (var liElement of document.querySelectorAll (selector))
{
if (liElement &&
liElement.firstElementChild instanceof HTMLElement &&
parseInt (window.getComputedStyle (liElement.firstElementChild).height) > max_height
) liElement.classList.add ("long-field-list")
}
})
Jmv