Skip to content

Add new option, footnote_link_text#774

Closed
BryceStevenWilley wants to merge 2 commits intogettalong:masterfrom
BryceStevenWilley:new_link_text_option
Closed

Add new option, footnote_link_text#774
BryceStevenWilley wants to merge 2 commits intogettalong:masterfrom
BryceStevenWilley:new_link_text_option

Conversation

@BryceStevenWilley
Copy link
Contributor

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
Contributor 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
Contributor 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.

@gettalong
Copy link
Owner

Thanks for the pull request! This will be in the next release.

@gettalong gettalong closed this Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: Option to make footnotes and footnote backlinks accessible

2 participants