csspython-sphinxrst2pdf

How to create a borderless table in rst2pdf?


I would like to create a borderless table in rst2pdf extension with Sphinx, but I can't seem to find a way to work around the stylesheet/css of the extension.

Any suggestions on this?


Solution

  • I just went through a "learning experience" with rst2pdf stylesheets, and while I may not have a complete answer for you, I think I can give you enough direction to get you started. A couple things I learned:

    To see how the default table style for rst2pdf is defined, you can execute the command rst2pdf --print-stylesheet or you can look at rst2pdf/styles/styles.yaml - you could then create a custom style in your stylesheet like borderless-table using that information (you may even be able to use table as the value of the parent element and override the commands element, but that is just an idea). Once you have your custom style defined, you should then be able to use it in your .rst file with the class directive:

    .. class:: borderless-table
    
    +----- your table definition here ----+
    

    Again, I haven't done this completely myself, so it's more of a partial solution or pointing in the general direction of the solution. rst2pdf is a great piece of software, but there are some devilish details that are not covered in the manual. Good luck!