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

Links are stripped from footnotes #23

Closed
mntn-xyz opened this issue Aug 31, 2021 · 1 comment · Fixed by #25
Closed

Links are stripped from footnotes #23

mntn-xyz opened this issue Aug 31, 2021 · 1 comment · Fixed by #25
Assignees
Labels
bug Something isn't working renderer Issue related to the Gemtext renderer
Milestone

Comments

@mntn-xyz
Copy link
Contributor

Original Markdown:

Itatur? Quiatae cullecum[^1] rem ent aut odis in re eossequodi nonsequ idebis ne sapicia[^2] is sinveli squiatum, core et que aut hariosam[^3] ex eat.

[^1]: Example footnote
[^2]: Example footnote with link to [example.com](https://example.com)
[^3]: [example.com](https://example.com)

Output:

Itatur? Quiatae cullecum[^1] rem ent aut odis in re eossequodi nonsequ idebis ne sapicia[^2] is sinveli squiatum, core et que aut hariosam[^3] ex eat.

[^1]: Example footnote
[^2]: Example footnote with link to example.com
[^3]: example.com

Note that the links in the footnotes are completely lost. I guess it would make sense to put the link right after the footnote, like this:

Itatur? Quiatae cullecum[^1] rem ent aut odis in re eossequodi nonsequ idebis ne sapicia[^2] is sinveli squiatum, core et que aut hariosam[^3] ex eat.

[^1]: Example footnote
[^2]: Example footnote with link to example.com

=> https://example.com example.com

[^3]: example.com

=> https://example.com example.com
@tdemin
Copy link
Owner

tdemin commented Aug 31, 2021

They are, and I am currently tackling this along with #17 by writing a generic link extractor.

@tdemin tdemin self-assigned this Aug 31, 2021
@tdemin tdemin added bug Something isn't working renderer Issue related to the Gemtext renderer labels Aug 31, 2021
@tdemin tdemin added this to the 0.3.0 milestone Aug 31, 2021
tdemin added a commit that referenced this issue Aug 31, 2021
Before this, links would only be scraped from paragraphs and
rendered as a block after parent paragraph. This replaces this logic
with a generic links extractor that would recursively collect every link
from any parent node, including footnotes, blockquotes, and lists.

Fixes #17 and #23.
tdemin added a commit that referenced this issue Sep 2, 2021
Before this, links would only be scraped from paragraphs and
rendered as a block after parent paragraph. This replaces this logic
with a generic links extractor that would recursively collect every link
from any parent node, including footnotes, blockquotes, and lists.

Fixes #23.
@tdemin tdemin linked a pull request Sep 2, 2021 that will close this issue
@tdemin tdemin closed this as completed in #25 Sep 3, 2021
tdemin added a commit that referenced this issue Sep 3, 2021
Before this, links would only be scraped from paragraphs and
rendered as a block after parent paragraph. This replaces this logic
with a generic links extractor that would recursively collect every link
from any parent node, including footnotes, blockquotes, and lists.

The renderer splits links block in three separate blocks, one
containing footnotes, the second containing images, and the third
links. Blocks are separated by a single line break.

This also makes the renderer skip link-only lists from rendering,
making them behave like links-only paragraphs (which are already
rendered as a series of consecutive links). The old behavior of
extracting links from links-only paragraphs (where the paragraph
itself is treated as just a set of links) remains, and can be still used.

The text extraction is also now unified across headings, paragraphs,
table headings, blockquotes, and other elements where it was used.
This fixes a number of bugs (like panicking on links inside headings)
and shortcomings where renderer would render text differently
based on container element type.

Fixes #17 and #23.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working renderer Issue related to the Gemtext renderer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants