Skip to content

markdown text is not parsed while exporting data in dash table #2644

Open
@kushalmraut

Description

@kushalmraut

General Description :
I am experiencing an issue with the Dash DataTable component when exporting data in CSV format. The problem is that Markdown-formatted text is not being properly parsed during export, and I would like to request a fix for this issue.

  • dash dependancies and versions
dash                 2.8.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-renderer        1.9.1
dash-table           5.0.0

Describe the bug

I have created a DataTable with a column containing Markdown-formatted text that includes hyperlinks. When I export the data to CSV using the built-in export feature, the Markdown is not parsed, and the raw Markdown text is exported instead.

Here's the code I'm using:

data = [
    {'column1': 'Text 1', 'column2': '[Link 1](https://example.com)'},
    {'column1': 'Text 2', 'column2': '[Link 2](https://example.org)'},
]

app.layout = html.Div([
    dash_table.DataTable(
        id='datatable',
        columns=[
            {'name': 'Column 1', 'id': 'column1'},
            {'name': 'Column 2', 'id': 'column2', 'type': 'text', 'presentation': 'markdown'},
        ],
        data=data,
        style_data_conditional=[
            {
                'if': {'column_id': 'column2'},
                'textAlign': 'left',
            },
        ],
        style_table={'overflowX': 'auto'},
        style_cell={'textAlign': 'left'},
        export_format="csv",
    ),
])

Actual Behavior:
When I export the data to CSV, the Markdown in Column 2 is not parsed, and the raw Markdown text, including the hyperlinks, is exported.

Expected Behavior:
I would like the Markdown to be properly parsed during export, and only the text (excluding the Markdown syntax) should be exported. This would result in CSV data that looks like the following:

Screenshots
Current UI Display::
image

Current Exported CSV Content:
image

Expected (Requested) CSV Content:
image

Additional Information:
I believe that fixing this issue would improve the usability of Dash DataTable's export functionality, especially when Markdown is used for text formatting. Thank you for your attention to this matter, and I hope to see a resolution soon.

Metadata

Metadata

Assignees

Labels

P3backlogbugsomething brokendash-data-tablerelated to DataTable component

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions