Replies: 2 comments 1 reply
-
FYI, your issue is unrelated to Quarto, it's a pure Python issue and understand of Look at what you are emitting with your function using You are not outputting: Title: **title**
Shape: **(12, 2)** But Title: **title**
Shape: **(12, 2)** Which is not at all the same thing. You need to refactor your code to produce unindented output, for example: import textwrap
def myfunc(title, df):
info = textwrap.dedent(f"""
Title: **{title}**
Shape: **{df.shape}**
""")
return info |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks for your reply def myfunc(title, df):
info = f"""Title: **{title}** <br />
Shape: **{df.shape}**<br />
"""
return info |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am using a Quarto notebook and a custom Python script with a function that returns a formatted string.
The function is supposed to return a string formatted in Markdown, but when I display it in the notebook, the Markdown formatting (e.g., bold text) is not applied.
Custom Python Script (tools.py)
Quarto notebook
Expected Output
Title: title
Shape: (12, 2)
Actual Output
"Title: **title** Shape: **(12, 2)**"
The Markdown formatting (bold text) is not applied, and the string is displayed as plain text.
Question
Is there a misconfiguration in my Quarto notebook or in the way I am using the Markdown function from IPython.display?
How can I ensure that the returned string is correctly formatted in Markdown?
Thanks for your help
Beta Was this translation helpful? Give feedback.
All reactions