Skip to content

Returns invalid attributes in tr/td elements #29

@Trott

Description

@Trott

Initial checklist

Affected packages and versions

[email protected]

Link to runnable example

No response

Steps to reproduce

Run the example.js file in the README with the example.md in the README as input.

Expected behavior

Output should match the output shown in the README.

Actual behavior

The output for the table has align="none" attribute showing up. This appears to be an interoperability issue between rehypeStringify and remark-gfm (and really the underlying micromark-extension-gfm-table and hast-util-to-html modules).

align="none" is not valid, or at least that's my reading of https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td#attr-align. Regardless, align is deprecated and I think the right thing to do here is omit it (which is what the example output does).

Here's the output I get:

<h1>GFM</h1>
<h2>Autolink literals</h2>
<p><a href="http://www.example.com">www.example.com</a>, <a href="https://example.com">https://example.com</a>, and <a href="mailto:[email protected]">[email protected]</a>.</p>
<h2>Footnote</h2>
<p>A note<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p>
<h2>Strikethrough</h2>
<p><del>one</del> or <del>two</del> tildes.</p>
<h2>Table</h2>
<table>
<thead>
<tr>
<th align="none">a</th>
<th align="left">b</th>
<th align="right">c</th>
<th align="center">d</th>
</tr>
</thead>
</table>
<h2>Tasklist</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" disabled> to do</li>
<li class="task-list-item"><input type="checkbox" checked disabled> done</li>
</ul>
<section data-footnotes class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol>
<li id="user-content-fn-1">
<p>Big note. <a href="#user-content-fnref-1" data-footnote-backref class="data-footnote-backref" aria-label="Back to content">↩</a></p>
</li>
</ol>
</section>

Runtime

Node v17

Package manager

npm v7

OS

macOS

Build and bundle tools

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions