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

Add new option, footnote_link_text #774

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

Conversation

BryceStevenWilley
Copy link

footnote_link_text is a string that is directly inserted in front of the footnote number. It can also be a formatted string that the number is formatted into.

For example, if the string is "[footnote %s]", the footnote link will be "[footnote 1]".

It will determine it the option is a forat string by running it through sprintf; if the output is the same, then it's not a format string.

Also adds tests to make sure of the new output.

Fixes #692, and is a different attempt at #693.

`footnote_link_text` is a string that is directly inserted in
front of the footnote number. It can also be a formatted string
that the number is formatted into.

For example, if the string is "[footnote %s]", the footnote link
will be "[footnote 1]".

It will determine it the option is a forat string by running it
through `sprintf`; if the output is the same, then it's not a
format string.

Also adds tests to make sure of the new output.
@gettalong gettalong self-assigned this Mar 15, 2023
@gettalong
Copy link
Owner

Thanks @BryceStevenWilley for the pull request!

What is the benefit of keeping the special case formatted_link_text == link_text? Wouldn't it be easier to omit that special case and make the default value '%s'.

@BryceStevenWilley
Copy link
Author

What is the benefit of keeping the special case formatted_link_text == link_text?

It lets folks use footnote_link_text without using the printf formatting. If they don't use the formatting (when formatted link is the same as the link text), we'll add the number at the end, so the links will still read as distinct.

Making the default case %s is a good idea though! Makes the default behavior much clearer, and introduces people to the formatting feature. I can make that change soon, unless you want to make it yourself.

@gettalong
Copy link
Owner

Thanks for the feedback! So I would go with the solution of %s being the default value. This also means the option description needs to be updated and there should be a validation block making sure that %s appears in the option value.

So that the footnotes will be labeled distinctly. Reduces some of the
necessary runtime code.
@BryceStevenWilley
Copy link
Author

BryceStevenWilley commented Mar 22, 2023

So I would go with the solution of %s being the default value. This also means the option description needs to be updated and there should be a validation block making sure that %s appears in the option value.

This is in now! Let me know if you want it changed at all, I tried to match the surrounding validation blocks, but wasn't certain how well I did.

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.

RFC: Option to make footnotes and footnote backlinks accessible
2 participants