Skip to content

XHTML output improperly self-closing DIV #15

@richardtallent-erm

Description

@richardtallent-erm

When using the xhtmlOut flag and the markdown-it-task-list plugin with the wrapper div option, the wrapper div is self-closed by markdown-it, so it no longer wraps the input and label, but the div's end tag is left as well, so the markup is invalid XHTML:

import MarkdownIt from "markdown-it"
import MarkdownItTaskCheckbox from "markdown-it-task-checkbox"

const xhtmlParser = MarkdownIt({
	html: true,
	xhtmlOut: true,
}).use(MarkdownItTaskCheckbox , { divWrap: true });
var html = xhtmlParser.render("- [ ] unchecked item 1");
console.log(html);
<ul class="task-list">
  <li class="task-list-item">
    <div class="checkbox" />
    <input type="checkbox" id="cbx_0" disabled="true" />
    <label for="cbx_0"> unchecked item 1</label>
    </div>
  </li>
</ul>

The MarkdownIt author quickly claimed that this is an issue with the plugin, not MarkdownIt. I'm not sure either way, as I'm not familiar enough with the plug-in API to know if your code below is calling MarkdownIt in some way that would result in this issue during XHTML output:

if (options.divWrap) {

Reference to the MarkdownIt issue:

markdown-it/markdown-it#911

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions