Skip to content

Commit 4cc06c0

Browse files
committed
🎨 raise ValueError if unknown type is provided
alternatively we could use a meaningful default
1 parent c2a0016 commit 4cc06c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/vuegen/streamlit_reportview.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,16 @@ def _format_text(
358358
str
359359
A formatted markdown string for the specified text.
360360
"""
361+
tag = ""
361362
if type == "header":
362363
tag = f"h{level}"
363364
elif type == "paragraph" or type == "caption":
364365
tag = "p"
365-
366-
return f"""st.markdown('''<{tag} style='text-align: {text_align}; color: {color};'>{text}</{tag}>''', unsafe_allow_html=True)"""
366+
else:
367+
raise ValueError(
368+
f"Unsupported text type: {type}. Supported types are 'header', "
369+
"'paragraph', and 'caption'."
370+
)
367371

368372
def _generate_home_section(
369373
self,

0 commit comments

Comments
 (0)