no captionless tables - speced/respec GitHub Wiki

no-captionless-tables linting rule

Default: true

Warns when a numbered <table> (with class="numbered") does not have a <caption> as its first child.

Example violation

<!-- BAD: numbered table without a caption -->
<table class="numbered">
  <tr><th>Feature</th><th>Status</th></tr>
  <tr><td>Thing</td><td>Done</td></tr>
</table>

How to fix

<table class="numbered">
  <caption>Feature implementation status</caption>
  <tr><th>Feature</th><th>Status</th></tr>
  <tr><td>Thing</td><td>Done</td></tr>
</table>

How to disable

var respecConfig = {
  lint: { "no-captionless-tables": false },
};

Notes

  • Only applies to <table class="numbered"> — unnumbered tables are not checked
  • The <caption> must be the first child of <table>
  • Captions are required for accessibility and for the auto-generated Table of Tables
⚠️ **GitHub.com Fallback** ⚠️