Skip to content

Commit 5e21e92

Browse files
committed
Remove the rel and rev attributes from footnotes
Since the `rev` attribute has been removed from the HTML 5 spec and the `rel` attribute doesn't accept `"footnote"` as a value anymore, let's remove them from the generated output for footnotes. It's still possible to have the previous behaviour with a custom render object. Fixes #536.
1 parent f22a17a commit 5e21e92

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
* Remove the `rel` and `rev` attributes from the output generated
4+
for footnotes as they don't pass the HTML 5 validation.
5+
6+
Fixes #536.
7+
38
* Automatically enable the `fenced_code_blocks` option passing a
49
`HTML_TOC` object to the `Markdown` object's constructor since
510
some languages rely on the sharp to comment code.

ext/redcarpet/html.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ rndr_footnote_def(struct buf *ob, const struct buf *text, unsigned int num, void
656656
bufprintf(ob, "\n<li id=\"fn%d\">\n", num);
657657
if (pfound) {
658658
bufput(ob, text->data, i);
659-
bufprintf(ob, "&nbsp;<a href=\"#fnref%d\" rev=\"footnote\">&#8617;</a>", num);
659+
bufprintf(ob, "&nbsp;<a href=\"#fnref%d\">&#8617;</a>", num);
660660
bufput(ob, text->data + i, text->size - i);
661661
} else if (text) {
662662
bufput(ob, text->data, text->size);
@@ -667,7 +667,7 @@ rndr_footnote_def(struct buf *ob, const struct buf *text, unsigned int num, void
667667
static int
668668
rndr_footnote_ref(struct buf *ob, unsigned int num, void *opaque)
669669
{
670-
bufprintf(ob, "<sup id=\"fnref%d\"><a href=\"#fn%d\" rel=\"footnote\">%d</a></sup>", num, num, num);
670+
bufprintf(ob, "<sup id=\"fnref%d\"><a href=\"#fn%d\">%d</a></sup>", num, num, num);
671671
return 1;
672672
}
673673

test/html_render_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ def test_that_footnotes_work
140140
Markdown
141141

142142
html = <<-HTML.chomp.strip_heredoc
143-
<p>This is a footnote.<sup id="fnref1"><a href="#fn1" rel="footnote">1</a></sup></p>
143+
<p>This is a footnote.<sup id="fnref1"><a href="#fn1">1</a></sup></p>
144144
145145
<div class="footnotes">
146146
<hr>
147147
<ol>
148148
149149
<li id="fn1">
150-
<p>It provides additional information.&nbsp;<a href="#fnref1" rev="footnote">&#8617;</a></p>
150+
<p>It provides additional information.&nbsp;<a href="#fnref1">&#8617;</a></p>
151151
</li>
152152
153153
</ol>

0 commit comments

Comments
 (0)