Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize footnotes #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dgnicholson
Copy link

This adds styling to footnotes so that they better match the theme and also includes enhancements their readability.

Footnote styling

Styles both the footnote numeral ([1]) and the footnote return icon (↩︎). Both now use the $primary color (_vars.scss) and implement a background on hover using lightened $primary—this a similar style that tags use. The blockquote footnote now matches this new style. Footnotes automatically add an <hr> above the footnotes area at the bottom of the post. Previously this provided no margin from the content and was unstyled. Both issues are corrected and <hr> now uses $grey (_vars.scss).

image

Footnote highlighting

Adds highlighting to the footnotes in a similar way to what Wikipedia does. When a user clicks on a footnote and the footnotes area is shown, the footnote in question is highlighted using $primary (_vars.scss) as a background with a quick gradient animation. This animation will end with a very light background highlighting the footnote. This background can improve readability when navigating posts that have a large number of footnotes.

image

I'm not sold on using $primary, so if another color (or a separate var) is better suited it can easily be changed.

Notes and known issues

Hugo changed from Blackfriday to Goldmark for Markdown. While this adds lots of improvements, it has limited how you can customize various syntax elements—including footnotes.

  • Footnotes break if multiple posts use footnotes on the same page. This happens because each post's footnote ID starts at fn:1 which causes clashes with other lists from other posts. While Blackfriday had the option to use a reference id (see plainIDAnchors = false), this does not appear to be the case for Goldmark.
  • The return icon can't be changed (see footnoteReturnLinkContents in Blackfriday).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant