(definitionHtml: string, n: number)
| 151 | } |
| 152 | |
| 153 | function appendBackref(definitionHtml: string, n: number): string { |
| 154 | const backref = ` <a href="#fnref-${n}" class="footnote-backref">↩</a>`; |
| 155 | // Inject the backref inside the trailing `</p>` so the arrow sits next to |
| 156 | // the last word of the last paragraph (pandoc style). If the definition |
| 157 | // doesn't end with a paragraph (rare — e.g. ends in a list), tack the |
| 158 | // backref on after the block. |
| 159 | const lastClose = definitionHtml.lastIndexOf('</p>'); |
| 160 | if (lastClose >= 0) |
| 161 | return `${definitionHtml.slice(0, lastClose)}${backref}${definitionHtml.slice(lastClose)}`; |
| 162 | return `${definitionHtml}${backref}`; |
| 163 | } |
no outgoing calls
no test coverage detected