How to define the the height of the csv table in reStructuredText?

血红的双手。 提交于 2021-02-05 08:47:26

问题


I'm using this code to create a table from csv for my documentation in readthedocs:

.. csv-table:: Markram et al. Model & Network configuration file
   :file: ../config_files/Markram_config_file.csv
   :header-rows: 1

The CSV is large and has a lot of rows and columns. For columns, everything is fine since it just fits a few columns in the page and the others can be accessed by scrolling to the right in the table. However, all of the rows are placed in the the page and I cannot specify a particular "length" or "height" for the csv table. I tried to specify the height by :height: 100px but it's not defined for the tables. Is there anyway to specify that? Here's a sample of what I'm using in the table.


回答1:


Immediately before your .. csv-table directive, put this above with a blank line separating (see https://stackoverflow.com/a/46195021/2214933):

.. rst-class:: table-myclass

.. csv-table:: blah blah blah

The above will apply a class name to the rendered HTML table.

Then in your Sphinx theme, add a custom style. Assuming you want to limit the height of each table row (not the table itself since 100px is pretty short for a lot of data) put the following:

table.myclass tbody tr {height: 100px;}

Adjust the CSS selector and style to taste.

See how to create custom styles in Sphinx.



来源:https://stackoverflow.com/questions/48689094/how-to-define-the-the-height-of-the-csv-table-in-restructuredtext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!