vivliostyle / vfm

⬇️ Open and extendable Markdown syntax and toolchain.
https://vivliostyle.github.io/vfm/#/vfm
Other
69 stars 12 forks source link

spec: missing support for table caption #150

Open kenhys opened 1 year ago

kenhys commented 1 year ago

Goals

Support markup of pre/post table caption

Prior Art

pandoc supports the following syntax.

: This is title

|item|description|
|-----|-----|
|aaa|explanation|

It will be converted into:

% pandoc table-pre-title.md
<table>
<caption>This is title</caption>
<thead>
<tr class="header">
<th>item</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>aaa</td>
<td>explanation</td>
</tr>
</tbody>
</table>

Then, the other syntax is:


|item|description|
|-----|-----|
|aaa|explanation|

Table: This is title

It will be converted into:

% pandoc table-post-title.md
<table>
<caption>This is title</caption>
<thead>
<tr class="header">
<th>item</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>aaa</td>
<td>explanation</td>
</tr>
</tbody>
</table>

Above samples were checked with:

% pandoc --version
pandoc 2.18

VFM results

% vfm --version
1.1.0
% vfm table-pre-title.md
<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <p>: This is title</p>
    <table>
      <thead>
        <tr>
          <th>item</th>
          <th>description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>aaa</td>
          <td>explanation</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>
% vfm table-post-title.md
<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <table>
      <thead>
        <tr>
          <th>item</th>
          <th>description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>aaa</td>
          <td>explanation</td>
        </tr>
      </tbody>
    </table>
    <p>Table: This is title</p>
  </body>
</html>