feat(opp): item detail full-text rendered by MdWidget (markdown, clickable links) - crawler now stores markdown detail_text

This commit is contained in:
yumoqing 2026-09-09 11:24:27 +08:00
parent f44e5f7f83
commit a066cb0f91

View File

@ -108,18 +108,17 @@ else:
] + link_btns
})
# ── 公告/需求全文(爬取平台保存的正文)──
# ── 公告/需求全文(markdown 渲染链接可点击2026-09-09 用户定夺改 MdWidget)──
detail_text = str(det.get("detail_text") or "").strip()
body.append({"widgettype": "Text", "options": {
"text": "全文内容", "cfontsize": 0.95, "color": "#0f172a",
"halign": "left", "margin": "0 0 4px 0"}})
if detail_text:
shown = detail_text[:8000]
if len(detail_text) > 8000:
shown += "\n……全文 %d 字,已截断显示,完整内容见原文页)" % len(detail_text)
body.append({"widgettype": "Text", "options": {
"text": shown, "cfontsize": 0.85, "color": "#334155",
"halign": "left", "wrap": True, "whiteSpace": "pre-wrap",
shown = detail_text[:20000]
if len(detail_text) > 20000:
shown += "\n\n……全文 %d 字,已截断显示,完整内容见原文页)" % len(detail_text)
body.append({"widgettype": "MdWidget", "options": {
"mdtext": shown, "width": "100%",
"padding": "8px 12px", "border": "1px solid #e2e8f0",
"borderRadius": "8px", "margin": "0 0 10px 0", "bgcolor": "#ffffff"}})
else: