Skip to content

Style for whole MediaWikiTable #43

Answered by thombashi
bukowski12 asked this question in Q&A
Discussion options

You must be logged in to vote

@bukowski12
Hi,
You can set style via table_style attribute of MediaWikiTableWriter class since pytablewriter 0.62.0:

import pytablewriter as ptw

writer = ptw.MediaWikiTableWriter(
    headers=["hoge", "foo"],
    value_matrix=[
        [1, "abc"],
        [2, "xyz"],
    ],
    table_style="display: inline-table;",
)
writer.write_table()
{| class="wikitable" style="display: inline-table;"
! hoge
! foo
|-
| style="text-align:right"| 1
| abc
|-
| style="text-align:right"| 2
| xyz
|}

note: This is an experimental feature for now. The interface may change in the future.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bukowski12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants