私の現在の環境では、マークダウンでテーブルを作ることができません。
でも、どうせデフォルトのテーブルデザインでは満足できないので細かく設定したくなります。
しかし、tailwind でいちいちテーブルを書くのも面倒です。
python でできないか chatGPT に質問してみました。
以下のような csv があるとします。
| 製品A | 製品B | 製品C | |
| 機能1 | ◎ | △ | 0 | 
| 機能2 | 0 | ◎ | × | 
| 機能3 | 0 | 0 | × | 
| 機能4 | 0 | 0 | △ | 
これを使ってテーブルを作成します。
import os
class createTbl:    def __init__(self):        self.csv = "/home/mituo/tbl.csv"        self.allarr = []        self.table_class = ''        self.th_row = True        self.th_row_class = "bg-blue-200 px-4 py-2"        self.th_col = False        self.th_col_class = 'bg-red-200'        self.td_row_class = 'bg-red-200'
    def readCSV(self):        with open(self.csv, 'r', encoding='utf-8') as f1:            allcsv = f1.read()            alldata = allcsv.strip().split("\n")            for ev in range(len(alldata)):                alldata[ev] = alldata[ev].split(",")            self.allarr = alldata
    def generate_table(self):        html_table = f'<table class="{self.table_class}">\n'        for i, row in enumerate(self.allarr):            html_table += '  <tr>\n'            for j, cell in enumerate(row):                if (i == 0 and self.th_row) or (j == 0 and self.th_col):                    html_table += f'    <th class="{self.th_row_class}">{cell}</th>\n'                else:                    html_table += f'    <td class="{self.td_row_class}">{cell}</td>\n'            html_table += '  </tr>\n'        html_table += '</table>'        return html_table
    def write_html(self, file_path):        html_content = self.generate_table()        with open(file_path, 'w', encoding='utf-8') as f:            f.write(html_content)
if __name__ == '__main__':    crTbl = createTbl()  # 最初の行は<th>、最初の列は<td>にする場合    crTbl.readCSV()    html_file_path = './file.html'    crTbl.write_html(html_file_path)テーブルで最初の行を th にするのは普通ですが、最初の列を th にしてそこに tailwind を設定する場合、ゴリゴリ書くのは面倒です。
そこで、__init__で設定します。
def __init__(self):    self.csv = "/home/mituo/tbl.csv"    self.allarr = []    self.table_class = ''    self.th_row = True    self.th_col = False    self.th_row_class = "bg-blue-200 px-4 py-2"    self.th_col_class = 'bg-red-200'    self.td_row_class = 'bg-red-200'これを実行すると table だけのファイルができるのでそれを貼り付けると以下のようになります。
つまり、最初の行を th にしたい時は「self.th_row = True」として tailwind を設定します。
| 製品A | 製品B | 製品C | |
|---|---|---|---|
| 機能1 | ◎ | △ | 0 | 
| 機能2 | 0 | ◎ | × | 
| 機能3 | 0 | 0 | × | 
| 機能4 | 0 | 0 | △ | 
最初の行と最初の列を th にしたい時は、両方とも「True」にしてそこに tailwind を設定します。
def __init__(self):  self.csv = "/home/mituo/tbl.csv"  self.allarr = []  self.table_class = ''  self.th_row = True  self.th_col = True  self.th_row_class = "bg-blue-200 px-4 py-2 border border-solid border-gray-500"  self.th_col_class = 'bg-orange-100 px-4 py-2 border border-solid border-gray-600'  self.td_row_class = 'bg-amber-50 px-4 py-2 border border-solid border-gray-300'こんな感じになります。
| 製品A | 製品B | 製品C | |
|---|---|---|---|
| 機能1 | ◎ | △ | 0 | 
| 機能2 | 0 | ◎ | × | 
| 機能3 | 0 | 0 | × | 
| 機能4 | 0 | 0 | △ | 
このようにすればテーブルタグを自由にカスタマイズでき、ほぼ一瞬でテーブルタグが生成されるので、そのコードをマークダウンに貼り付ければ表示することができます。