At the moment, sphinx-gallery generates a div for each gallery item.
These divs are float: left and have a pre-determined width, which does not render very nicely on most screen sizes or for long titles.
I suggest that for each subsection of the gallery, we add a parent div to these item divs.
This would allow users to either use css grid or flex (which we could also implement here directly).
It boils down to adding a new div before iterating through each gallery item and closing this div after:
|
entries_text = [] |
|
costs = [] |
|
build_target_dir = os.path.relpath(target_dir, gallery_conf['src_dir']) |
|
iterator = sphinx_compatibility.status_iterator( |
|
sorted_listdir, |
|
'generating gallery for %s... ' % build_target_dir, |
|
length=len(sorted_listdir)) |
|
for fname in iterator: |
|
intro, title, cost = generate_file_rst( |
|
fname, target_dir, src_dir, gallery_conf, seen_backrefs) |
|
src_file = os.path.normpath(os.path.join(src_dir, fname)) |
|
costs.append((cost, src_file)) |
Also, maybe we could use sphinx-design to handle the grid for us, but this would add a new dependency.
Happy to here what you think about this!
At the moment, sphinx-gallery generates a div for each gallery item.
These divs are
float: leftand have a pre-determined width, which does not render very nicely on most screen sizes or for long titles.I suggest that for each subsection of the gallery, we add a parent div to these item divs.
This would allow users to either use css
gridorflex(which we could also implement here directly).It boils down to adding a new div before iterating through each gallery item and closing this div after:
sphinx-gallery/sphinx_gallery/gen_rst.py
Lines 371 to 382 in a68a486
Also, maybe we could use
sphinx-designto handle the grid for us, but this would add a new dependency.Happy to here what you think about this!