Question

I am trying to place a bulleted list in my reST simple table, but each line of the bulleted list gets its own row:

======================  =======================  =======================
|foo.png|               |bar.png|                |baz.png|
======================  =======================  =======================
* foo1 - Lorem ipsum    * bar                    * baz 
  dolor sit amet, 
  consectetur 
* foo2 - adipisicing 
  elit
======================  =======================  =======================

.. |foo.png| image:: assets/img/foo.png
.. |bar.png| image:: assets/img/bar.png
.. |baz.png| image:: assets/img/baz.png

The result is that each of the lines * foo1 - Lorem ipsum, dolor sit amet,, consectetur, * foo2 - adipisicing and elit are placed into separate table rows.

The desired result is that the bulleted list in the first column is contained in one table row item. Is there an easy way to get the result I am after?

Failing that, is there a way to embed an HTML table of my design in a reST document?

Another thing I have tried is a replacement:

======================  =======================  =======================
|foo.png|               |bar.png|                |baz.png|
======================  =======================  =======================
|foo_list|              |bar_list|               |baz_list|
======================  =======================  =======================

.. |foo.png| image:: assets/img/foo.png
.. |bar.png| image:: assets/img/bar.png
.. |baz.png| image:: assets/img/baz.png

.. |foo_list| replace::
   * foo1 - Lorem ipsum dolor sit amet, consectetur
   * foo2 - adipisicing elit
.. |bar_list| replace::
   * bar
.. |baz_list| replace::
   * baz

This did not work at all, showing the text |foo_list| in the first, top-left cell underneath the |foo.png| image.

Was it helpful?

Solution

Try the list-table directive:

.. list-table:: Example table
   :header-rows: 1

   * - First header
     - Second header
     - Third header
   * - Some text
     - Some text
     - A list:
         * foo
         * bar
         * baz
   * - Second row
     - More cells
     - etc.
   * - ...
     - ...
     - ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top