bindery
bindery copied to clipboard
RunningHeader displaying footnote marker from heading
If footnotes are applied to a link in a header, the RunningHeader will display the superscript number. e.g., <h1><a href="">Title</a></h1> will show as "Title1" in the running header given the following:
Bindery.Footnote({
selector: "a",
render: (el, number) => `<span class="footnote"><sup>${ number }</sup><a href="${ el.href }">${ el.href }</a></span>`,
}),
Bindery.RunningHeader({
render: (page) => {
if (page.isEmpty) return "";
else if (page.element.querySelector("h1")) return "";
else if (page.isLeft) return `<div class="running-header"><span class="page-number">${ page.number }</span> ${ page.heading.h1 }</div>`;
},
}),
lol good catch. if it showed the original header would that be sufficient? or would you want to specify running headers that don't correspond to the text of the h1-h6 tags?
Being able to specify a query selector would be useful so you could do things like page.heading[".chapter-title"] + ": " + page.heading.h1 for the running header.