A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Draft Idea/Spec/Proposal] New tag: data with attribute type in HTML

raphaellouis
2022-05-20

1. Problem

Sometimes some data is mixed with html, I would like to have a layer in the html to separate data that is not of type html…

2. Solution

So I would like to have a new tag - better, a new element in the html

example.html

<data type="csv">
id,name,amount,Remark
1,"Johnson, Smith, and Jones Co.",345.33,Pays on time
2,"Sam ""Mad Dog"" Smith",993.44,
3,"Barney & Company",0,"Great to work with
and always pays with cash."
4,Johnson's Automotive,2344,
</data>

output.html

<table class="table table-bordered table-hover table-condensed">
   <thead>
      <tr>
         <th title="Field #1">id</th>
         <th title="Field #2">name</th>
         <th title="Field #3">amount</th>
         <th title="Field #4">Remark</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td align="right">1</td>
         <td>Johnson, Smith, and Jones Co.</td>
         <td align="right">345.33</td>
         <td>Pays on time</td>
      </tr>
      <tr>
         <td align="right">2</td>
         <td>Sam &quot;Mad Dog&quot; Smith</td>
         <td align="right">993.44</td>
         <td> </td>
      </tr>
      <tr>
         <td align="right">3</td>
         <td>Barney &amp; Company</td>
         <td align="right">0</td>
         <td>Great to work with<br/>and always pays with cash.</td>
      </tr>
      <tr>
         <td align="right">4</td>
         <td>Johnson&#39;s Automotive</td>
         <td align="right">2344</td>
         <td> </td>
      </tr>
   </tbody>
</table>

3. Notes

  • All data inside the data tag is rendered as a table

4. References