dahlsailrunner / knowyourtoolset-blog

MIT License
0 stars 0 forks source link

2018/02/controlling-the-width-of-a-table-with-read-the-docs/ #7

Closed utterances-bot closed 1 year ago

utterances-bot commented 1 year ago

Controlling the Width of a Table With Read-the-Docs | Know Your Toolset

Preventing the inclusion of a scroll bar in a ReadTheDocs table - all of the content will show on the page and in the table - just taller.

https://knowyourtoolset.com/2018/02/controlling-the-width-of-a-table-with-read-the-docs/

EISTW commented 1 year ago

Great information. Is this also possible for a mkdocs-generated ReadTheDocs site?

dahlsailrunner commented 1 year ago

I did a little looking and it seems like you could do it with css if you wanted the same width for EVERY table you generated, but you may need to customize the theme code itself in some way if you wanted some variation.

wowone commented 1 year ago

Thank you Erik. I've stumbled upon the same problem. You saved a lot of my time. And what's the most important, now I know that it's possible to override any unexpected behaviour with patching css files.

dahlsailrunner commented 1 year ago

Glad to hear it @wowone!

hbshrestha commented 1 year ago

Thank you for this article! I'd like to wrap the text, but I want to create table using the csv-table directive: .. csv-table:: xyz

    :header-rows: 1

    :file: path/file.csv

Do you know if it is possible to wrap the text in the table created using csv files in the rst files for sphinx documentation?

dahlsailrunner commented 1 year ago

I've not done anything like that before but I would imagine that you'd be able to apply the class directive and reference some css just like in other places.

:class: tight-table

have you tried that?

hbshrestha commented 1 year ago

Thank you for the response. I added the following in css file

.tight-table {
    white-space: normal !important;
}

And then called it in the rst file as follows:

image

However, I could not get the required result when I build the page: image

I am wondering what could be the reason for it.

dahlsailrunner commented 1 year ago

I haven't really worked much in ReadTheDocs recently -- I've moved to Hugo static sites (they take better advantage of screen real estate and use markdown (much more widely supported). Feel free to post what you find here.