https://dagster.io/ logo
#ask-ai
Title
# ask-ai
j

Joram Sbrisny

03/06/2024, 7:46 PM
@Scout: How can i make a new line in the asset description
s

Scout

03/06/2024, 7:46 PM
To create a new line in the asset description, you can use a multi-line string in Python, which is denoted by triple quotes (
"""
). However, there has been an issue reported where multi-line docstrings for assets were not being rendered correctly in Dagit, Dagster's UI. The issue indicated that Dagit was displaying the entire docstring as one long line in the description, rather than respecting the newlines. The issue discussion suggested that explicitly setting the description with escaped newlines (
\n
) should render correctly, with the first line appearing in the asset node's description box and further lines of the description in the sidebar when you click the node. Here are the examples provided in the issue:
Copy code
python @asset(description="This is a multi-line\\n\\ndoc string") def asset1():     return 2  @asset(description="## This is a markdown\\n\\nMultiline doc string") def asset2():     return 2
In these examples, the
description
parameter of the
@asset
decorator is used to set a multi-line description, with
\\n\\n
used to create a new line. Please note that the issue discussion also mentioned that running Python docstrings through
dedent
replaces double-newlines with single newlines, but Markdown allows for text wrapping and only double-newlines start new text blocks. Therefore, when writing descriptions for assets, it's important to consider how they will be rendered in Dagit and to test the appearance in the UI. If you encounter any issues with rendering newlines in asset descriptions, you may want to check the latest updates on the issue or reach out to the Dagster community for assistance.
3 Views