From 40a7621c197d54b75eb403e3d2eafc56ec470487 Mon Sep 17 00:00:00 2001 From: Brief <91160+brief@users.noreply.github.com> Date: Wed, 12 Aug 2020 18:05:37 -0700 Subject: [PATCH] Keep footnote backlinks with text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This inserts a non-breaking space before backlinks to prevent them from being separated from footnote text. Results in the following when text wraps: ``` 1. Roses are red, violets are blue ↩ ``` Instead of this: ``` 1. Roses are red, violets are blue ↩ ``` --- extension/_test/footnote.txt | 10 +++++----- extension/footnote.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extension/_test/footnote.txt b/extension/_test/footnote.txt index 9b06721..aad2c19 100644 --- a/extension/_test/footnote.txt +++ b/extension/_test/footnote.txt @@ -12,7 +12,7 @@ That's some text with a footnote.[^1]
  1. And that's the footnote.

    -

    That's the second paragraph. ↩︎

    +

    That's the second paragraph. ↩︎

@@ -37,13 +37,13 @@ This[^3] is[^1] text with footnotes[^2].
  1. -

    Footnote three ↩︎

    +

    Footnote three ↩︎

  2. -

    Footnote one ↩︎

    +

    Footnote one ↩︎

  3. -

    Footnote two ↩︎

    +

    Footnote two ↩︎

@@ -61,7 +61,7 @@ test![^1]
  1. -

    footnote ↩︎

    +

    footnote ↩︎

diff --git a/extension/footnote.go b/extension/footnote.go index ede72db..f3d0dcb 100644 --- a/extension/footnote.go +++ b/extension/footnote.go @@ -258,7 +258,7 @@ func (r *FootnoteHTMLRenderer) renderFootnoteBackLink(w util.BufWriter, source [ if entering { n := node.(*ast.FootnoteBackLink) is := strconv.Itoa(n.Index) - _, _ = w.WriteString(` `) _, _ = w.WriteString("↩︎")