From a4cc879e435da24257c45d168b5d7c4839e8585e Mon Sep 17 00:00:00 2001 From: microsounds Date: Wed, 6 Sep 2023 00:28:24 -0700 Subject: [PATCH] Don't use empty attribute syntax in HTML renderer See: https://github.com/github/cmark-gfm/issues/245 Fixed a regression introduced in 0.29.0.gfm.2, where cmark-gfm would emit empty data-* attributes in HTML renderer, valid as HTML5, but invalid as XHTML. --- src/html.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/html.c b/src/html.c index 22513c939..0de329a6e 100644 --- a/src/html.c +++ b/src/html.c @@ -68,7 +68,7 @@ static bool S_put_footnote_backref(cmark_html_renderer *renderer, cmark_strbuf * cmark_strbuf_puts(html, "as.literal.data, node->as.literal.len); - cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref data-footnote-backref-idx=\""); + cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref=\"data-footnote-backref\" data-footnote-backref-idx=\""); cmark_strbuf_puts(html, m); cmark_strbuf_puts(html, "\" aria-label=\"Back to reference "); cmark_strbuf_puts(html, m); @@ -84,7 +84,7 @@ static bool S_put_footnote_backref(cmark_html_renderer *renderer, cmark_strbuf * houdini_escape_href(html, node->as.literal.data, node->as.literal.len); cmark_strbuf_puts(html, "-"); cmark_strbuf_puts(html, n); - cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref data-footnote-backref-idx=\""); + cmark_strbuf_puts(html, "\" class=\"footnote-backref\" data-footnote-backref=\"data-footnote-backref\" data-footnote-backref-idx=\""); cmark_strbuf_puts(html, m); cmark_strbuf_puts(html, "-"); cmark_strbuf_puts(html, n); @@ -422,7 +422,7 @@ static int S_render_node(cmark_html_renderer *renderer, cmark_node *node, case CMARK_NODE_FOOTNOTE_DEFINITION: if (entering) { if (renderer->footnote_ix == 0) { - cmark_strbuf_puts(html, "
\n
    \n"); + cmark_strbuf_puts(html, "
    \n
      \n"); } ++renderer->footnote_ix; @@ -451,7 +451,7 @@ static int S_render_node(cmark_html_renderer *renderer, cmark_node *node, cmark_strbuf_puts(html, n); } - cmark_strbuf_puts(html, "\" data-footnote-ref>"); + cmark_strbuf_puts(html, "\" data-footnote-ref=\"data-footnote-ref\">"); houdini_escape_href(html, node->as.literal.data, node->as.literal.len); cmark_strbuf_puts(html, ""); }