Is there an example of how to create a markdown ar...
# prefect-server
m
Is there an example of how to create a markdown artifact?
m
Hello Marc! There is my super simple example of creating a table.
Copy code
from prefect.artifacts import create_markdown
from prefect import task, Flow

@task
def get_items():
    item = ["one", "two", "three", "four"]
    items = []
    for i in range(4):
        items.append(item)
    return items

@task()
def parse_artifact_format(item):
    row = "| " + " | ".join(item) + "|\n"
    return row

@task(name="Create Table")
def generate_artifact(info_markdown_format):
    table = "".join(info_markdown_format)
    create_markdown(
        f"| Column | Column | Column | Column |\n| ----------- | ----------- | ----------- | ----------- |\n{table}"
    )


with Flow(
    name="Markdown Flow"
) as flow:
    items = get_items()
    info_markdown_format = parse_artifact_format.map(items)
    generate_artifact(info_markdown_format)

if __name__ == "__main__":
    flow.register(project_name="Examples")
    # flow.run()
🙌 1
m
thanks!
c
@Berty Pribilovics cool ^^