dagster-io / dagster

An orchestration platform for the development, production, and observation of data assets.
https://dagster.io
Apache License 2.0
11.49k stars 1.45k forks source link

Inconsistent rendering of newlines in output metadata #16740

Open bkozura opened 1 year ago

bkozura commented 1 year ago

Dagster version

1.4.16

What's the issue?

When a string or markdown includes a newline character '\n', newlines do not render as expected and are inconsistent between "Run view" and "Materialization view"/"Asset view".

Pasted Graphic 37 Pasted Graphic 38 Pasted Graphic 39 image

What did you expect to happen?

All new lines should render in output metadata

How to reproduce?

metadata = {
    "string_with_single_newline": "The hills are alive with the sound \n of music",
    "string_md_with_single_newline": MetadataValue.md("The hills are alive with the sound \n of music"),
    "string_with_double_newline": "The hills are alive with the sound \n\n of music",
    "string_md_with_double_newline": MetadataValue.md("The hills are alive with the sound \n\n of music"),
}
context.add_output_metadata(metadata=metadata)

Deployment type

Local

Deployment details

No response

Additional information

No response

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

clairelin135 commented 1 year ago

Thanks @bkozura for reporting -- tagging the UI team for visibility

tnk-dev commented 11 months ago

We experience the same issue, in which we have to resort to a less aesthetic representation in our Asset Event View Plus 1

cliguda commented 4 months ago

A +1 from me as well. SQL statements look very ugly without linebreaks

bengotow commented 4 months ago

Hey gang, thanks for reporting this -- I think the newline behavior may be somewhat expected. In Markdown, a single newline is non-rendering by default (it's just text wrapping you can insert to your liking) and a double newline creates a paragraph break.

I think what you're after may be the \ modifier (https://stackoverflow.com/questions/33191744/how-to-add-new-line-in-markdown-presentation) -- that will tell Markdown that a specific newline is meaningful and you should get two separate lines in Dagster.

(Full disclosure I haven't had a chance to test the \ yet - let me know if that doesn't work!)