(str)
| 229 | |
| 230 | // 增强的内容渲染函数 |
| 231 | function isJsonString(str) { |
| 232 | try { |
| 233 | const trimmed = str.trim(); |
| 234 | if ((trimmed.startsWith('{') && trimmed.endsWith('}')) || |
| 235 | (trimmed.startsWith('[') && trimmed.endsWith(']'))) { |
| 236 | JSON.parse(trimmed); |
| 237 | return true; |
| 238 | } |
| 239 | return false; |
| 240 | } catch (e) { |
| 241 | return false; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | function formatJsonContent(content) { |
| 246 | try { |