Skip to content

[flutter_markdown] Soft wrapping in blockquotes - #7848

Merged
auto-submit[bot] merged 4 commits into
flutter:mainfrom
andrechalella:main
Oct 13, 2024
Merged

[flutter_markdown] Soft wrapping in blockquotes#7848
auto-submit[bot] merged 4 commits into
flutter:mainfrom
andrechalella:main

Conversation

@andrechalella

Copy link
Copy Markdown
Contributor

Makes flutter_markdown treat paragraphs in blockquotes like a normal paragraph with respect to soft wrapping.

Currently, line breaks in blockquotes translate directly to line breaks in the output. This happens regardless of the Markdown Specification chosen. Such behavior is different from most Markdown implementations, including the reference ones cited in flutter_markdown (Dart Markdown Live Editor and the Markdown Live Preview).

Example:

> my
> blockquote

Currently renders like:

my
blockquote

And this PR fixes it to become:

my blockquote

Note: previewing in this GitHub editor, I get the hard-wrap behavior. However, Dart Markdown Live Editor gives the soft-wrap behavior in all flavors, even when "GitHub Flavored Markdown" is selected. Reading the GFM spec there's an example that to me implies that soft-wrapping is the correct thing in GFM, plus that's what I gather from reading 6.12 and 6.13. However, if for some reason we should hard-wrap in GFM, it should be just a matter of checking the chosen extensionSet when deciding whether to call trimText(). Seems clear to me hard-wrapping shouldn't ever be the only behavior.

Issues: this fixesflutter/flutter#156554

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@nate-thegratenate-thegrate left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once we get the checks passing.

Thanks for the fix!

Comment threadpackages/flutter_markdown/pubspec.yaml Outdated
Comment threadpackages/flutter_markdown/CHANGELOG.md Outdated
Comment threadpackages/flutter_markdown/test/blockquote_test.dart Outdated
@nate-thegrate

Copy link
Copy Markdown
Contributor

previewing in this GitHub editor, I get the hard-wrap behavior.

Yeah, I've noticed the GitHub website is a bit funky, since it notices all line breaks in issue or PR comments, but if you upload a .md file then it follows traditional markdown rules (i.e. only break if there are 2 spaces or a \ at the end).

@andrechalella

Copy link
Copy Markdown
ContributorAuthor

Ok, it's passing now. I don't know why the version number was bad, I tried to follow the latest changes which just fixed minor stuff.

@nate-thegrate

Copy link
Copy Markdown
Contributor

I don't know why the version number was bad

I don't fully understand it either, but thanks for fixing it!

One small thing to mention—it looks like a settings.json file may have been added by accident.

@andrechalella

Copy link
Copy Markdown
ContributorAuthor

Sorry, that was just some GitHub VS Code garbage! I think it's fixed now.

@nate-thegrate

Copy link
Copy Markdown
Contributor

Awesome!

We'll be able to merge once the PR has 2 approvals.

@nate-thegratenate-thegrate added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 13, 2024
@auto-submit
auto-submitBot merged commit 17b714a into flutter:mainOct 13, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 14, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 14, 2024
auto-submitBot pushed a commit to flutter/flutter that referenced this pull request Oct 14, 2024
flutter/packages@67401e1...1e670f2
2024-10-14 stuartmorgan@google.com [image_picker] Update for non-nullable generics in Pigeon (flutter/packages#7775)
2024-10-14 109111084+yaakovschectman@users.noreply.github.com [camera_android] Convert calls from native to dart side to Pigeon. (flutter/packages#7857)
2024-10-14 109111084+yaakovschectman@users.noreply.github.com [google_maps_flutter_android] Update JSON code to Pigeon for `BitmapDescriptor`, `Cap`, and `PatternItem` (flutter/packages#7840)
2024-10-13 andrechalella@gmail.com [flutter_markdown] Soft wrapping in blockquotes (flutter/packages#7848)
2024-10-12 stuartmorgan@google.com [google_maps_flutter] Update iOS Pigeon for non-nullable generics (flutter/packages#7792)
2024-10-11 10687576+bparrishMines@users.noreply.github.com [pigeon] Swift implementation for ProxyApis (flutter/packages#6602)
2024-10-11 echo.ellet@gmail.com [camera_android_camerax] Remove duplicated 'report' in README.md (flutter/packages#7708)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a human
is aware of the problem.
To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
Makes `flutter_markdown` treat paragraphs in blockquotes like a normal paragraph with respect to soft wrapping.
Currently, line breaks in blockquotes translate directly to line breaks in the output. This happens regardless of the Markdown Specification chosen. Such behavior is different from most Markdown implementations, including the reference ones cited in [flutter_markdown ](https://pub.dev/packages/flutter_markdown) ([Dart Markdown Live Editor](https://dart-lang.github.io/markdown/) and the [Markdown Live Preview](https://markdownlivepreview.com/)).
Example:
```
> my
> blockquote
```
Currently renders like:
> my
> blockquote
And this PR fixes it to become:
> my blockquote
Note: previewing in this GitHub editor, I get the hard-wrap behavior. However, [Dart Markdown Live Editor](https://dart-lang.github.io/markdown/) gives the soft-wrap behavior in all flavors, even when "GitHub Flavored Markdown" is selected. Reading the GFM spec [there's an example](https://github.github.com/gfm/#example-222) that to me implies that soft-wrapping is the correct thing in GFM, plus that's what I gather from reading [6.12](https://github.github.com/gfm/#hard-line-breaks) and [6.13](https://github.github.com/gfm/#soft-line-breaks). However, if for some reason we should hard-wrap in GFM, it should be just a matter of checking the chosen `extensionSet` when deciding whether to call `trimText()`. Seems clear to me hard-wrapping shouldn't ever be the only behavior.
Issues: this fixesflutter/flutter#156554
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
Makes `flutter_markdown` treat paragraphs in blockquotes like a normal paragraph with respect to soft wrapping.
Currently, line breaks in blockquotes translate directly to line breaks in the output. This happens regardless of the Markdown Specification chosen. Such behavior is different from most Markdown implementations, including the reference ones cited in [flutter_markdown ](https://pub.dev/packages/flutter_markdown) ([Dart Markdown Live Editor](https://dart-lang.github.io/markdown/) and the [Markdown Live Preview](https://markdownlivepreview.com/)).
Example:
```
> my
> blockquote
```
Currently renders like:
> my
> blockquote
And this PR fixes it to become:
> my blockquote
Note: previewing in this GitHub editor, I get the hard-wrap behavior. However, [Dart Markdown Live Editor](https://dart-lang.github.io/markdown/) gives the soft-wrap behavior in all flavors, even when "GitHub Flavored Markdown" is selected. Reading the GFM spec [there's an example](https://github.github.com/gfm/#example-222) that to me implies that soft-wrapping is the correct thing in GFM, plus that's what I gather from reading [6.12](https://github.github.com/gfm/#hard-line-breaks) and [6.13](https://github.github.com/gfm/#soft-line-breaks). However, if for some reason we should hard-wrap in GFM, it should be just a matter of checking the chosen `extensionSet` when deciding whether to call `trimText()`. Seems clear to me hard-wrapping shouldn't ever be the only behavior.
Issues: this fixesflutter/flutter#156554
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit Appp: flutter_markdown

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blockquotes hard wrap when they should soft wrap like a normal paragraph

3 participants

@andrechalella@nate-thegrate@domesticmouse