craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

[4.x]: Markdown directive just returns `\n` for line breaks instead of `<br>` when querying field on Neo via GraphQL #11494

Closed TGriffiths88 closed 2 years ago

TGriffiths88 commented 2 years ago

What happened?

Description

Using Markdown directive when querying a multi-line text field simply returns \n instead of <br>. Currently the field Im querying is sitting within a Neo block.

Steps to reproduce

  1. Create a multi-line text field within a Neo block
  2. Query it via GraphQL and use the @markdown directive
  3. String returned will contain \n for line breaks

Expected behavior

The string returned should contain <br> tags

Actual behavior

The string contains \n for line breaks

Craft CMS version

4.0.4

PHP version

8.1.5

Operating system and version

Linux 4.15.0-167-generic

Database type and version

MySQL 5.7.38

Image driver and version

Imagick 3.6.0 (ImageMagick 6.9.7-4)

Installed plugins and versions

brandonkelly commented 2 years ago

Markdown only replaces newlines with <br> tags for lines that end in two or more spaces. Just tested locally and that’s working as expected.