How can I hard-wrap within a long link?

In some contexts (email, software repositories) it is necessary to hard-wrap text files at a set margin (say 72 or 80 characters). Within a regular paragraph, CommonMark treats hard-wraps as soft-wraps, and this works well. But I can’t figure out how to hard-wrap a long link. For example…

Please read my
[poem](http://twas.brillig.and.the.slithy.toves.did.gyre.and.gimble.in.the.wabe.all.mimsy.were.the.borogoves.and.the.mome.raths.outgrabe.jabberwocky.com)

or

[Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/)

Is there any way to hard-break within a [text](link) construct?

You could use a reference link to keep the lengths of the lines to 80 characters in the second example:

[Creative Commons Attribution-ShareAlike 4.0 International License][cc]

[cc]: http://creativecommons.org/licenses/by-sa/4.0/

But for longer links, I don’t think it’s possible to avoid going over the line limit (without resorting to the use of raw HTML). It’s worth asking how important keeping to the line limit is in these cases, since the link will be less readable when split up over multiple lines.

1 Like

Link texts (inside the (first) pair of square brackets) may contain line breaks. Link destinations should be able to contain line breaks if surrounded by angle brackets:

[foo
bar](baz)

[foo](<bar
baz>)

Currently, this will add a space in the output where the line break is, e.g.

[CommonMark Spec](<https://spec.
commonmark.org>)

Produces

[CommonMark Spec](<https://spec. commonmark.org>)
1 Like