refactor: 彻底移除所有 Mermaid 支持

- 从 argontheme.js 移除所有 Mermaid 相关代码和注释
- 从 style.css 移除所有 Mermaid 样式(约 300 行)
- 移除代码高亮中跳过 mermaid 容器的逻辑
- 移除 PJAX 清理函数中的 Mermaid 引用
- 删除临时清理脚本和空文档
This commit is contained in:
2026-01-27 10:42:08 +08:00
parent 8a74a3b3f6
commit 0a8bb3a453
26 changed files with 542 additions and 11418 deletions

View File

@@ -4585,45 +4585,7 @@ function shortcode_video($attr,$content=""){
$out .= "</video>";
return $out;
}
add_shortcode('mermaid','shortcode_mermaid');
function shortcode_mermaid($attr,$content=""){
// 预处理内容:移除 WordPress 自动添加的 <p> 和 <br> 标签
$content = shortcode_content_preprocess($attr, $content);
// 获取参数
$theme = isset( $attr['theme'] ) ? $attr['theme'] : 'default';
$width = isset( $attr['width'] ) ? $attr['width'] : '100%';
$height = isset( $attr['height'] ) ? $attr['height'] : 'auto';
$align = isset( $attr['align'] ) ? $attr['align'] : 'center';
// 生成唯一 ID
$chart_id = 'mermaid-' . mt_rand(1000000000, 9999999999);
// 构建输出
$out = '<div class="mermaid-shortcode-container" style="text-align: ' . esc_attr($align) . ';">';
$out .= '<div class="mermaid-shortcode" ';
$out .= 'id="' . esc_attr($chart_id) . '" ';
$out .= 'data-theme="' . esc_attr($theme) . '" ';
$out .= 'style="width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . ';">';
$out .= esc_html($content);
$out .= '</div>';
$out .= '</div>';
return $out;
}
/**
* 从内容中移除 Mermaid shortcode用于文章预览
* 避免在预览中显示原始 Mermaid 代码
*
* @param string $content 文章内容
* @return string 移除 Mermaid shortcode 后的内容
*/
function argon_remove_mermaid_from_preview($content) {
// 移除 [mermaid]...[/mermaid] shortcode
$content = preg_replace('/\[mermaid[^\]]*\].*?\[\/mermaid\]/is', '[Mermaid 图表]', $content);
return $content;
}
add_shortcode('hide_reading_time','shortcode_hide_reading_time');
function shortcode_hide_reading_time($attr,$content=""){
return "";
@@ -10975,8 +10937,6 @@ function argon_normalize_social_url($platform, $input) {
return esc_url($base_urls[$platform] . $username);
}
// ==========================================================================
// Mermaid 图表支持 - 配置管理
// ==========================================================================
/**
@@ -11211,8 +11171,6 @@ function argon_update_mermaid_settings($settings) {
];
}
// ==========================================================================
// Mermaid 图表支持 - 库加载器
// ==========================================================================
/**