|
|
@ -380,7 +380,12 @@ public class DocumentTaskResultsServiceImpl implements IDocumentTaskResultsServi |
|
|
|
.addAttributes("table", "border", "cellpadding", "cellspacing") |
|
|
|
.addAttributes("img", "src", "alt", "width", "height"); // 允许img标签及其属性
|
|
|
|
htmlContent = Jsoup.clean(htmlContent, "", safelist, settings); |
|
|
|
htmlContent = htmlContent.replaceAll("(?s)<pre><code>(.*?)</code></pre>", |
|
|
|
"<div style='background-color:#f6f8fa;border:1px solid #ddd;'>$1</div>"); |
|
|
|
|
|
|
|
// 处理行内代码 - 将行内code替换为带内联样式的span (不使用class)
|
|
|
|
htmlContent = htmlContent.replaceAll("<code>(.*?)</code>", |
|
|
|
"<span style='background-color:#f6f8fa;border:1px solid #ddd;'>$1</span>"); |
|
|
|
// 创建完整的HTML文档,使用微软雅黑
|
|
|
|
String html = String.format(""" |
|
|
|
<!DOCTYPE html> |
|
|
|