jekyll-relative-links icon indicating copy to clipboard operation
jekyll-relative-links copied to clipboard

Handle Line-Wrapped Links

Open hasheddan opened this issue 5 years ago • 15 comments

Is your feature request related to a problem? Please describe the problem you're trying to solve.

Currently, if a link is wrapped in valid markdown style (i.e. line break in either text or url section), it is not handled by the relative links plugin.

Describe the solution you'd like

Line wrapped links handled in the same manner as normal links.

Describe alternatives you've considered

Other options include not line-wrapping links (can be painful if the rest of the doc is line-wrapped), or using permalinks to force all to .md (can break if directory structure is generated by outside source).

Additional context

Example:

[my cool link](cool-doc.md)

gets correctly converted to:

[my cool link](cool-doc.html)

But,

[my cool 
link](cool-doc.md)

does not get handled and still points to cool-doc.md.

I am happy to do the work to implement this feature, but will likely need some direction :)

hasheddan avatar Mar 27 '20 14:03 hasheddan

@benbalter is this as simple as adding /m option to INLINE_LINK_REGEX (and REFERENCE_LINK_REGEX if we want that also) to enable multi-line mode? https://github.com/benbalter/jekyll-relative-links/blob/c00abd291eb161f9627724c9941d4937c47a9864/lib/jekyll-relative-links/generator.rb#L14

hasheddan avatar Mar 27 '20 14:03 hasheddan

Based on https://spec.commonmark.org/, I don't believe links can have new lines in them. Do you read the spec otherwise?

benbalter avatar Mar 27 '20 14:03 benbalter

@benbalter thank you for the quick response :) You can have breaks in an in-line markdown link as long as it does not break the actual link text. Examples: https://gist.github.com/hasheddan/0fcebadaa82f29fd51ab0bcd36d193dd

Gist
GitHub Gist: instantly share code, notes, and snippets.

hasheddan avatar Mar 27 '20 15:03 hasheddan

Some examples with the commonmark tool: https://spec.commonmark.org/dingus/?text=%5Ba%20cool%0Alink%5D(%2Furl)%0A%0A%5Banother%20cool%0Alink%5D(%0A%2Furl)%0A%0A%5B%0Aand%20another%20one%0A%5D(%2Furl)%0A

hasheddan avatar Mar 27 '20 16:03 hasheddan

👍 just ran into this issue when debugging why some links were not handled correctly, but others did, and came to the same conclusion that it was due to those links being wrapped. I would prefer wrapped links to work, as it's quite commonly used.

thaJeztah avatar Mar 31 '20 11:03 thaJeztah

@benbalter I am happy to make this update 👍 I don't work with Ruby too frequently, any tips on building / testing this project?

hasheddan avatar Mar 31 '20 12:03 hasheddan

@benbalter just following up here :) anything I can do to help?

hasheddan avatar Apr 07 '20 15:04 hasheddan

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 06 '20 15:06 stale[bot]

@benbalter i would love to help get this fixed, any chance we could reopen this?

hasheddan avatar Jun 07 '20 12:06 hasheddan

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 08 '20 08:08 stale[bot]

still relevant

thaJeztah avatar Aug 08 '20 08:08 thaJeztah

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 11 '20 23:10 stale[bot]

still relevant

thesofakillers avatar Oct 12 '20 13:10 thesofakillers

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 25 '20 16:12 stale[bot]

Still relevant. Just lost a bunch of hours trying to pin down our issues.

aaronmw avatar Jan 30 '23 21:01 aaronmw