(title, caption)
| 1062 | } |
| 1063 | |
| 1064 | function createGeneratedCover(title, caption) { |
| 1065 | var safeTitle = escapeXml(title || 'AI Article'); |
| 1066 | var safeCaption = escapeXml(caption || 'AI notes · tools · workflow'); |
| 1067 | var svg = [ |
| 1068 | '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 540">', |
| 1069 | '<rect width="960" height="540" fill="#effaf6"/>', |
| 1070 | '<rect x="44" y="44" width="872" height="452" rx="24" fill="#ffffff" stroke="#bfe8dc" stroke-width="2"/>', |
| 1071 | '<path d="M80 388H880" stroke="#00b38a" stroke-width="8" stroke-linecap="round"/>', |
| 1072 | '<text x="80" y="148" fill="#008f70" font-family="Arial, sans-serif" font-size="34" font-weight="700">cxuan-ai-labs</text>', |
| 1073 | '<foreignObject x="80" y="194" width="800" height="150">', |
| 1074 | '<div xmlns="http://www.w3.org/1999/xhtml" style="font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Arial,sans-serif;font-size:44px;font-weight:800;line-height:1.28;color:#303c39;">', |
| 1075 | safeTitle, |
| 1076 | '</div>', |
| 1077 | '</foreignObject>', |
| 1078 | '<foreignObject x="80" y="426" width="800" height="52">', |
| 1079 | '<div xmlns="http://www.w3.org/1999/xhtml" style="font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Arial,sans-serif;font-size:22px;font-weight:600;line-height:1.35;color:#7b8a86;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">', |
| 1080 | safeCaption, |
| 1081 | '</div>', |
| 1082 | '</foreignObject>', |
| 1083 | '</svg>' |
| 1084 | ].join(''); |
| 1085 | |
| 1086 | return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg); |
| 1087 | } |
| 1088 | |
| 1089 | function escapeXml(text) { |
| 1090 | return String(text).replace(/[&<>"']/g, function (char) { |
no test coverage detected