You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shapelets平台Markdown文本渲染不符合预期问题求助

Shapelets平台Markdown文本未渲染问题解决

问题场景

使用Shapelets-platform制作HR演示仪表板时,添加介绍文本采用了常规Markdown语法,但内容未按预期渲染,所有文本直接原样显示。

原代码

from shapelets.apps import DataApp
app = DataApp(name= "Presentation HR")

text = app.text("""# Human Resources Analytics
in this presentation, we will be analyzing the data of a company to see if we can find any patterns that can help us predict if an employee will leave the company or not.
I want to start by thanking the company for giving us access to their data and for trusting us with it.
Moreover, I want to thank my team for their hard work and dedication to this project.

# Data
The data we have been given is a csv file with 12 columns and 14999 rows.
The columns are:
- satisfaction_level
- last_evaluation
- number_project
- average_montly_hours
- time_spend_company
- Work_accident
- left
- promotion_last_5years
- sales
- salary
- salary_num
- sales_num
""")

app.place(text)
app.register()

问题原因

Shapelets的app.text()组件默认不启用Markdown解析功能,所以输入的Markdown语法会被当作普通文本直接展示。

解决方法

在app.text()调用时添加markdown=True参数,显式开启Markdown渲染。修改后的代码如下:

from shapelets.apps import DataApp
app = DataApp(name= "Presentation HR")

text = app.text("""# 人力资源分析
本次演示中,我们将分析某公司的数据,尝试找出能够预测员工是否会离职的潜在规律。
首先感谢该公司提供数据并给予我们信任,同时也感谢团队成员为这个项目付出的努力与专注。

# 数据说明
我们拿到的是一个CSV文件,包含12个字段、14999条数据。
字段列表如下:
- satisfaction_level(满意度)
- last_evaluation(最近绩效评估)
- number_project(参与项目数)
- average_montly_hours(月均工时)
- time_spend_company(司龄)
- Work_accident(是否发生过工作事故)
- left(是否已离职)
- promotion_last_5years(近5年是否获得晋升)
- sales(所属部门)
- salary(薪资水平)
- salary_num(薪资数值)
- sales_num(部门编码)
""", markdown=True)  # 启用Markdown渲染

app.place(text)
app.register()

添加该参数后,组件会自动识别并解析文本中的Markdown语法,将标题、列表等格式正确渲染展示。

内容的提问来源于stack exchange,提问作者Chen Sofia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 06:52:43