syntax-tree / mdast-util-to-hast

Compare c8e1ea7 ... +8 ... 892a85c

Showing 2 of 3 files from the diff.
Other files ignored by Codecov
readme.md has changed.

@@ -13,6 +13,7 @@
Loading
13 13
14 14
/**
15 15
 * @param {H} h
16 +
 * @returns {Element|null}
16 17
 */
17 18
export function footer(h) {
18 19
  let index = -1
@@ -108,8 +109,8 @@
Loading
108 109
    children: [
109 110
      {
110 111
        type: 'element',
111 -
        tagName: 'h2',
112 -
        properties: {id: 'footnote-label', className: ['sr-only']},
112 +
        tagName: h.footnoteLabelTagName,
113 +
        properties: JSON.parse(JSON.stringify(h.footnoteLabelProperties)),
113 114
        children: [u('text', h.footnoteLabel)]
114 115
      },
115 116
      {type: 'text', value: '\n'},

@@ -44,6 +44,8 @@
Loading
44 44
 * @property {boolean} dangerous Whether HTML is allowed
45 45
 * @property {string} clobberPrefix Prefix to use to prevent DOM clobbering
46 46
 * @property {string} footnoteLabel Label to use to introduce the footnote section
47 +
 * @property {string} footnoteLabelTagName HTML used for the footnote label
48 +
 * @property {Properties} footnoteLabelProperties properties on the HTML tag used for the footnote label
47 49
 * @property {string} footnoteBackLabel Label to use to go back to a footnote call from the footnote section
48 50
 * @property {(identifier: string) => Definition|null} definition Definition cache
49 51
 * @property {Record<string, FootnoteDefinition>} footnoteById Footnote cache
@@ -73,6 +75,13 @@
Loading
73 75
 *   Label to use for the footnotes section.
74 76
 *   Affects screen reader users.
75 77
 *   Change it if you’re authoring in a different language.
78 +
 * @property {string} [footnoteLabelTagName='h2']
79 +
 *   HTML tag to use for the footnote label.
80 +
 *   Can be changed to match your document structure and play well with your choice of css.
81 +
 * @property {Properties} [footnoteLabelProperties={id: 'footnote-label', className: ['sr-only']}]
82 +
 *   Properties to use on the footnote label.
83 +
 *   A 'sr-only' class is added by default to hide this from sighted users.
84 +
 *   Change it to make the label visible, or add classes for other purposes.
76 85
 * @property {string} [footnoteBackLabel='Back to content']
77 86
 *   Label to use from backreferences back to their footnote call.
78 87
 *   Affects screen reader users.
@@ -119,6 +128,8 @@
Loading
119 128
      ? 'user-content-'
120 129
      : settings.clobberPrefix
121 130
  h.footnoteLabel = settings.footnoteLabel || 'Footnotes'
131 +
  h.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'
132 +
  h.footnoteLabelProperties = settings.footnoteLabelProperties || {id: 'footnote-label', className: ['sr-only']}
122 133
  h.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'
123 134
  h.definition = definitions(tree)
124 135
  h.footnoteById = footnoteById

Learn more Showing 1 files with coverage changes found.

Changes in lib/index.js
+3
Loading file...
Files Coverage
lib 100.00%
index.js 100.00%
Project Totals (29 files) 100.00%
Loading