Tuesday, December 12, 2023

csv2table

I like this vscode extension by Michel SLAGMULDER.

    you press ctrl H ctrl T on some selected csv and it converts to and HTML table. (although the command isn't working for me on linux mint so i use the command palate instead ctrl shift p)


    arggg you know what sucks though? it doesn't escape  the characters inside double quotes. so you've got a date like "sept, 11, 1905" it thinks you have 3 columns. SOO ANNNOYING. (I was wondering why the default delimiter was set to semi-colon instead of comma.)

gotta do a find and replace with a regex. heres the pattern I use to match:

,(?=(?:[^"]*"[^"]*")*[^"]*$)

open vscode live server = alt L O

format HTML = ctrl shift i 

bootstrap has dark mode add this to the head: data-bs-theme="dark"

<html lang="en" data-bs-theme="dark">

     basic table css styling:

table, th, td {
  border: 1px solid;
}

    Striped tables:

<style>
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {background-color: #f2f2f2;}
</style> 



No comments:

Post a Comment