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

Enforce the footnote number to render on the same line as preceding word #405

Open
kamar535 opened this issue Nov 3, 2017 · 2 comments
Open

Comments

@kamar535
Copy link

kamar535 commented Nov 3, 2017

For the following markdown:

A sentence with a footnote.[^target]

[^target]: Target text

, depending on the line width, the period may be rendered at the end of a line and the footnote number on the next line.

image

Would be great if Blackfriday would enforce the footnote number to be rendered on the same line as the preceding word (including any trailing punctuation).

image

I came up with a solution in Hugo where I used a regexp to wrapp the generated footnote.<sup class="footnote-ref"> ... </sup> inside a <span class="footnote">footnote.<sup class="footnote-ref"> ...</sup></span> and the following css:

span.footnote {
    white-space: nowrap;
}

Would be great if this could be added as an option to Blackfriday.

@kamar535
Copy link
Author

kamar535 commented Nov 7, 2017

Sorry, ignore this. It turned out this was only an issue with a specific Hugo theme, see https://discourse.gohugo.io/t/is-it-possible-to-enforce-the-footnote-number-to-render-on-same-line-as-preceding-symbol/9085/14

@kamar535 kamar535 closed this as completed Nov 7, 2017
@kamar535
Copy link
Author

kamar535 commented Nov 7, 2017

When there is no white space before the footnote tag there is no issue.

A sentence with a footnote.[^target]

This will (if not tweaked by CSS) always render the footnote on the same line as the preceding footnote..

screen shot 2017-11-08 at 00 09 37

screen shot 2017-11-08 at 00 09 47

But as discussed here there are still cases that might be handled by Blackfriday. Whenever there is whitespace before the footnote markup, for example:

A sentence with a footnote. [^target]

, the footnote may be rendered on the next line.

screen shot 2017-11-08 at 00 18 50

By replacing any whitespace before the [^target] markup with&nbsp; as in for example:

A sentence with a footnote.&nbsp;[^target]

, this will force the footnote to be rendered on the same line as the preceding non-whitespace text footnote.

screen shot 2017-11-08 at 00 21 26

screen shot 2017-11-08 at 00 21 35

@kamar535 kamar535 reopened this Nov 7, 2017
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

No branches or pull requests

1 participant