mdformat icon indicating copy to clipboard operation
mdformat copied to clipboard

Wrap Text in Links

Open hannob opened this issue 9 months ago • 0 comments

Context

It appears mdformat never adds line breaks within a link description. This can lead to excessively long lines.

Example:

[This is a very extremely absolutely excessively long extra long sentence with a link in it](https://example.com/).

mdformat --wrap 80 does not change this input at all. I would expect an output like this:

[This is a very extremely absolutely excessively long extra long sentence with a
link in it](https://example.com/).

It appears to be allowed by the commonmark spec to have newlines in the link text, see the example here: https://spec.commonmark.org/0.31.2/#example-541

Proposal

The wrap functionality should also wrap text inside a link text.

hannob avatar Mar 25 '25 19:03 hannob