Markdown not rendering properly

Hello everyone,

I am attempting to use Markdown to insert some instructions in my application.

However, when I use:

import dash_core_components as dcc
dcc.Markdown(‘’’
#### text
> text2
text3
‘’')
it renders as:

#### text
> text2
text3

which is, I see the text, but I also see the Markdown commands inserted, and there is absolutely no formatting.
Since I am musing tabs, I have the following versions of dash and dcc installed:

dash==0.21.0
dash-renderer==0.11.3
dash-html-components==0.9.0
dash-core-components==0.21.0rc1

Could the version be the issue. I mean, Markdown seems to be recognized and somehow working since it doesn’t throw and error nor prevent the app to work, but it doesn’t render correctly either.

Thanks a lot,
Romain

It’s likely an issue with indentation: In markdown, if the text is indented, it treats it as a codeblock.

Try wrapping your text in:

from textwrap import dedent

dcc.Markdown(dedent('''
     # Header
     Text
'''))
5 Likes

Absolutely, that was the problem. Thanks a lot for your help.

1 Like

Hi Chris,

Is there a way to upload a Markdown sheet to the dash app instead of hard coding it? Thanks.