diff --git a/lib/handlers/footnote-reference.js b/lib/handlers/footnote-reference.js index 8f7825c..40883a0 100644 --- a/lib/handlers/footnote-reference.js +++ b/lib/handlers/footnote-reference.js @@ -9,7 +9,7 @@ function footnoteReference(h, node) { return h(node.position, 'sup', {id: 'fnref-' + identifier}, [ h(node, 'a', {href: '#fn-' + identifier, className: ['footnote-ref']}, [ - u('text', identifier) + u('text', node.label || identifier) ]) ]) } diff --git a/test/footnote-reference.js b/test/footnote-reference.js index 1e5ba21..dee1d98 100644 --- a/test/footnote-reference.js +++ b/test/footnote-reference.js @@ -6,35 +6,34 @@ var to = require('..') test('FootnoteReference', function(t) { t.deepEqual( - to( - u('footnoteReference', { - identifier: 'alpha' - }) - ), - u( - 'element', - { - tagName: 'sup', - properties: { - id: 'fnref-alpha' - } - }, - [ - u( - 'element', - { - tagName: 'a', - properties: { - href: '#fn-alpha', - className: ['footnote-ref'] - } - }, - [u('text', 'alpha')] - ) - ] - ), + to(u('footnoteReference', {identifier: 'alpha'})), + u('element', {tagName: 'sup', properties: {id: 'fnref-alpha'}}, [ + u( + 'element', + { + tagName: 'a', + properties: {href: '#fn-alpha', className: ['footnote-ref']} + }, + [u('text', 'alpha')] + ) + ]), 'should render `footnoteReference`s' ) + t.deepEqual( + to(u('footnoteReference', {identifier: 'alpha', label: 'Alpha'})), + u('element', {tagName: 'sup', properties: {id: 'fnref-alpha'}}, [ + u( + 'element', + { + tagName: 'a', + properties: {href: '#fn-alpha', className: ['footnote-ref']} + }, + [u('text', 'Alpha')] + ) + ]), + 'should render `footnoteReference`s (#2)' + ) + t.end() })