bindery icon indicating copy to clipboard operation
bindery copied to clipboard

RunningHeader displaying footnote marker from heading

Open teddybradford opened this issue 8 years ago • 2 comments

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>`;
  },
}),

teddybradford avatar Aug 05 '17 16:08 teddybradford

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?

evnbr avatar Aug 06 '17 19:08 evnbr

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.

teddybradford avatar Aug 07 '17 19:08 teddybradford