@@ -103,11 +103,13 @@ To add parameters to how the markdown table is formatted, you can use the `set_p
103103| | | None | No row separators will be |
104104| | | | inserted |
105105+-----------------------+---------------------+-------------------+--------------------------------+
106- | padding_width | int | | Allocate padding to all table |
107- | | | | cells |
106+ | padding_width | int or | | Allocate padding to all table |
107+ | | dict<str,int> | | cells when passing an int or |
108+ | | | | per-column when passing a dict |
108109+-----------------------+---------------------+-------------------+--------------------------------+
109- | padding_weight | str | | Strategy for allocating |
110- | | | | padding within table cells |
110+ | padding_weight | str or | | Strategy for allocating |
111+ | | dict<str,str> | | padding within table cells. |
112+ | | | | Per-column when passing a dict |
111113+-----------------------+---------------------+-------------------+--------------------------------+
112114| | | left | Aligns the cell's contents to |
113115| | | | the end of the cell |
@@ -341,6 +343,79 @@ markdown_table(data).set_params(row_sep = 'always', padding_width = 5, padding_w
341343</details >
342344<br />
343345
346+ ``` python
347+ markdown_table(data).set_params(row_sep = ' always' , padding_width = 5 , padding_weight = ' centerright' , padding_char = ' .' ).get_markdown()
348+ ```
349+ <details >
350+ <summary >
351+ see example
352+ </summary>
353+
354+ ```
355+ +------------------------------------------------------------+
356+ |......title......|......time......|.....date.....|..seats...|
357+ +-----------------+----------------+--------------+----------+
358+ |..Vrij Zwemmen...|..21:30-23:00...|..Wed 09.12...|..24/24...|
359+ +-----------------+----------------+--------------+----------+
360+ |..Vrij Zwemmen...|..12:00-13:00...|..Thu 10.12...|..18/18...|
361+ +-----------------+----------------+--------------+----------+
362+ |..Vrij zwemmen...|...7:30-8:30....|..Fri 11.12...|..18/18...|
363+ +-----------------+----------------+--------------+----------+
364+ |..Vrij Zwemmen...|..13:15-14:15...|..Sat 12.12...|..18/18...|
365+ +------------------------------------------------------------+
366+ ```
367+ </details >
368+ <br />
369+
370+ ### Per-column padding and padding weight
371+ ``` python
372+ markdown_table(data).set_params(row_sep = ' always' , padding_width = {" title" : 2 , " time" : 4 , " date" : 3 , " seats" : 1 }, padding_weight = {" title" : " left" , " time" : " right" , " date" : " centerleft" , " seats" : " centerright" }).get_markdown()
373+
374+ ```
375+ <details >
376+ <summary >
377+ see example
378+ </summary>
379+
380+ ```
381+ +--------------------------------------------------+
382+ | title|time | date |seats |
383+ +--------------+---------------+------------+------+
384+ | Vrij Zwemmen|21:30-23:00 | Wed 09.12 |24/24 |
385+ +--------------+---------------+------------+------+
386+ | Vrij Zwemmen|12:00-13:00 | Thu 10.12 |18/18 |
387+ +--------------+---------------+------------+------+
388+ | Vrij Zwemmen|7:30-8:30 | Fri 11.12 |18/18 |
389+ +--------------+---------------+------------+------+
390+ | Vrij Zwemmen|13:15-14:15 | Sat 12.12 |18/18 |
391+ +--------------------------------------------------+
392+ ```
393+ </details >
394+ <br />
395+
396+
397+ ``` python
398+ markdown_table(data).set_params(row_sep = ' always' , padding_width = {" A" : 2 , " B" : 4 , " C" : 3 }, padding_weight = {" A" : " left" , " B" : " right" , " C" : " centerleft" }).get_markdown()
399+ ```
400+ <details >
401+ <summary >
402+ see example
403+ </summary>
404+
405+ ```
406+ +-----------------------------------------------------------------------+
407+ | A|B | C |
408+ +-----------------------------+-------------------------------+---------+
409+ | row1_A and additional stuff|row1_B | row1_C |
410+ +-----------------------------+-------------------------------+---------+
411+ | row2_A|row2_B and additional stuff | row2_C |
412+ +-----------------------------+-------------------------------+---------+
413+ | row3_A|row3_B | row3_C |
414+ +-----------------------------------------------------------------------+
415+ ```
416+ </details >
417+ <br />
418+
344419### Multiline and emoji
345420``` python
346421markdown_table(data).set_params(padding_width = 0 , padding_weight = " centerleft" , multiline = {" A" : 25 , " B" : 12 , " C" : 9 }).get_markdown()
0 commit comments