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

fix: multi-paragraph footnotes #121

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/generation/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ fn gen_footnote_reference(footnote_reference: &FootnoteReference, _: &mut Contex
fn gen_footnote_definition(footnote_definition: &FootnoteDefinition, context: &mut Context) -> PrintItems {
let mut items = PrintItems::new();
items.push_string(format!("[^{}]: ", footnote_definition.name.trim()));
items.extend(gen_nodes(&footnote_definition.children, context));
items.extend(with_indent_times(gen_nodes(&footnote_definition.children, context), 4));
items
}

Expand Down
117 changes: 117 additions & 0 deletions tests/specs/Issues/Issue0076.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
!! should format !!
Some paragraph with a footnote[^1].

[^1]: Footnotes, as well as endnotes, are strings of text placed at the bottom
of a page in a book or document or at the end of a chapter, volume, or the whole
text.

The footnote can provide an author's comments on the main text or
[citations](https://en.wikipedia.org/wiki/Citation) of a reference work in
support of the text.

[expect]
Some paragraph with a footnote[^1].

[^1]: Footnotes, as well as endnotes, are strings of text placed at the bottom
of a page in a book or document or at the end of a chapter, volume, or the whole
text.

The footnote can provide an author's comments on the main text or
[citations](https://en.wikipedia.org/wiki/Citation) of a reference work in
support of the text.

!! should keep footnote indented !!
# Example

[^1]: This is a footnote content.

Here is a simple footnote[^1].
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br> With some additional text after it[^@#$%]
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br> and without disrupting the
blocks[^bignote].
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>

[^bignote]:

The first paragraph of the definition.

Paragraph two of the definition.

> A blockquote with
> multiple lines.

~~~
a code block
~~~

| Header 1 | Header 2 |
| -------- | -------- |
| Cell 1 | Cell 2 |

A \`final\` paragraph before list.

- Item 1
- Item 2
- Subitem 1
- Subitem 2

[^@#$%]: A footnote on the label: "@#$%".

[expect]
# Example

[^1]: This is a footnote content.

Here is a simple footnote[^1].
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br> With some additional text after it[^@#$%]
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br> and without disrupting the
blocks[^bignote].
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>

[^bignote]: The first paragraph of the definition.

Paragraph two of the definition.

> A blockquote with
> multiple lines.

```
a code block
```

| Header 1 | Header 2 |
| -------- | -------- |
| Cell 1 | Cell 2 |

A \`final\` paragraph before list.

- Item 1
- Item 2
- Subitem 1
- Subitem 2

[^@#$%]: A footnote on the label: "@#$%".
Loading