-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Handle Line-Wrapped Links #61
Comments
@benbalter is this as simple as adding
|
Based on https://spec.commonmark.org/, I don't believe links can have new lines in them. Do you read the spec otherwise? |
@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
|
👍 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. |
@benbalter I am happy to make this update 👍 I don't work with Ruby too frequently, any tips on building / testing this project? |
@benbalter just following up here :) anything I can do to help? |
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. |
@benbalter i would love to help get this fixed, any chance we could reopen this? |
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. |
still relevant |
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. |
still relevant |
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. |
Uses https://github.com/gjtorikian/commonmarker to create an AST, manipulates the AST to rewrite links, and then converts back into markdown. Fixes benbalter#61 Fixing benbalter#61 was the main motivation for doing this fundamental change, as it wasn't obvious how to manipulate the regex to accomplish allowing newlines the markdown link text (not the URL). Unforununately the test suite did not respond well to this change, as much of the suite is expecting that the *only* thing modified is the link text, whereas since we roundtrip now from source -> ast -> markdown, there are several bits of the original source that are not respected. For example, in certain situations ' quotes are replaced with ". There are also some minor newline changes, in fact links with newlines in the text are rewritten to be on a single line. Lastly, the handing of footnotes is different, as the AST/parser does not represent a footnote 'source' as it's own entity, the footnotes are simply 'followed' and reference links are rewritten to be replaced with the reference's link. These changes required quite a bit of surgery on the test suite.
Allows for links to work equally on systemd.io and on https://github.com/systemd/systemd/tree/main/docs The markdown links are converted by jekyll-relative-links[1] enabled by default on github pages[2][3]. Due to a bug in jekyll-relative-links – see benbalter/jekyll-relative-links#61 – we need to avoid line-wrapped links when using relative markdown links. [1] https://github.com/benbalter/jekyll-relative-links [2] https://github.blog/2016-12-05-relative-links-for-github-pages/ [3] https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins
Allows for links to work equally on systemd.io and on https://github.com/systemd/systemd/tree/main/docs The markdown links are converted by jekyll-relative-links[1] enabled by default on github pages[2][3]. Due to a bug in jekyll-relative-links – see benbalter/jekyll-relative-links#61 – we need to avoid line-wrapped links when using relative markdown links. [1] https://github.com/benbalter/jekyll-relative-links [2] https://github.blog/2016-12-05-relative-links-for-github-pages/ [3] https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins
Allows for links to work both on systemd.io (or forks) and when viewed on https://github.com/systemd/systemd/tree/main/docs Note that the markdown links are converted by jekyll-relative-links[1] to html. This plugin is enabled by default on github pages[2][3]. Due to a bug in jekyll-relative-links – see benbalter/jekyll-relative-links#61 – we need to avoid line-wrapped links when using relative markdown links. [1] https://github.com/benbalter/jekyll-relative-links [2] https://github.blog/2016-12-05-relative-links-for-github-pages/ [3] https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins
Allows for links to work both on systemd.io (or forks) and when viewed on https://github.com/systemd/systemd/tree/main/docs Note that the markdown links are converted by jekyll-relative-links[1] to html. This plugin is enabled by default on github pages[2][3]. Due to a bug in jekyll-relative-links – see benbalter/jekyll-relative-links#61 – we need to avoid line-wrapped links when using relative markdown links. [1] https://github.com/benbalter/jekyll-relative-links [2] https://github.blog/2016-12-05-relative-links-for-github-pages/ [3] https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins
Allows for links to work both on systemd.io (or forks) and when viewed on https://github.com/systemd/systemd/tree/main/docs Note that the markdown links are converted by jekyll-relative-links[1] to html. This plugin is enabled by default on github pages[2][3]. Due to a bug in jekyll-relative-links – see benbalter/jekyll-relative-links#61 – we need to avoid line-wrapped links when using relative markdown links. [1] https://github.com/benbalter/jekyll-relative-links [2] https://github.blog/2016-12-05-relative-links-for-github-pages/ [3] https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins
Allows for links to work both on systemd.io (or forks) and when viewed on https://github.com/systemd/systemd/tree/main/docs Note that the markdown links are converted by jekyll-relative-links[1] to html. This plugin is enabled by default on github pages[2][3]. Due to a bug in jekyll-relative-links – see benbalter/jekyll-relative-links#61 – we need to avoid line-wrapped links when using relative markdown links. [1] https://github.com/benbalter/jekyll-relative-links [2] https://github.blog/2016-12-05-relative-links-for-github-pages/ [3] https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll#plugins
Still relevant. Just lost a bunch of hours trying to pin down our issues. |
Line-wrapping breaks link translation by jekyll-relative-links: benbalter/jekyll-relative-links#61
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:
gets correctly converted to:
But,
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 :)
The text was updated successfully, but these errors were encountered: