You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for dprint! I love it and hope it takes over the formatting world and we never have to wait for Prettier again! I would like to propose to never wrap links even if textWrap is set to always.
Details
Prettier never wraps links even if their title is longer than 80 characters. In this example in the Prettier playground the link is only on line 2. Dprint currently wraps links: in the equivalent example in the dprint playground the link ends up on lines 2-3 in the formatted output.
Rationale
Keeping links on a single line makes processing markdown text line by line so much easier, for example grepping with regexes, showing only matching lines in search results, or when syntax highlighting. I'd also argue that keeping the link on one line improves readability of the formatted output since links could be considered a logical unit in the content. It is easier to read Markdown when links stay "together". This change wouldn't affect HTML rendered from the Markdown.
Implementation
If you agree and provide some guidance around how to implement this, I'm happy to take a stab at it.
The text was updated successfully, but these errors were encountered:
This seems reasonable given that prettier doesn't wrap (never noticed that... I'll investigate later if this happens for other things). I will run it by a few people.
To implement this, I think we would just need to use the Context to mark "we're in a link now" in parse_inline_link (similar to is_in_list_count on Context) then in get_space_or_newline_base_on_config we could maybe rename that function then have it also take into account whether it's inside a link (so when it's inside a link it would return " " instead of Signal::SpaceOrNewLine).
Also, thanks, I'm glad you like it and thanks for sponsoring 🙂
Thanks for dprint! I love it and hope it takes over the formatting world and we never have to wait for Prettier again! I would like to propose to never wrap links even if
textWrap
is set toalways
.Details
Prettier never wraps links even if their title is longer than 80 characters. In this example in the Prettier playground the link is only on line 2. Dprint currently wraps links: in the equivalent example in the dprint playground the link ends up on lines 2-3 in the formatted output.
Rationale
Keeping links on a single line makes processing markdown text line by line so much easier, for example grepping with regexes, showing only matching lines in search results, or when syntax highlighting. I'd also argue that keeping the link on one line improves readability of the formatted output since links could be considered a logical unit in the content. It is easier to read Markdown when links stay "together". This change wouldn't affect HTML rendered from the Markdown.
Implementation
If you agree and provide some guidance around how to implement this, I'm happy to take a stab at it.
The text was updated successfully, but these errors were encountered: