/* wx-mp-pro.css * 专业微信公众号排版样式 * 参考:https://mp.weixin.qq.com/s/lFy98TGBSdsdSbymWZDRVg * 目标: * - 提供专业的技术类文章排版 * - 适合程序员教程、开发文档等内容 * - 精心调整的标题层级、代码块、表格和引用样式 * - 确保在微信公众号环境下不丢失关键样式 * 使用方式: * - 在导出设置中选择 wx-mp-pro 主题 */ .note2any { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; font-size: 16px; line-height: 1.75; color: #2f2f2f; background: #ffffff; margin: 0; padding: 0; } /* 段落 */ .note2any p { margin: 1.2em 0; letter-spacing: 0.05px; } /* 标题:更专业清晰的层级感 */ .note2any h1, .note2any h2, .note2any h3, .note2any h4, .note2any h5, .note2any h6 { margin: 2.2em 0 1em; line-height: 1.4; color: #111111; font-weight: 600; border-radius: 8px; letter-spacing: 2px; } .note2any h1, .note2any h2, .note2any h3, .note2any h4, .note2any h5 { } /* H1:卡片式 */ .note2any h1 { font-size: 1.8em; margin: 1.5em 0; color: #1565F6; background: #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); padding: 20px 20px 20px 25px; } /* H2:左条卡片 */ .note2any h2 { font-size: 1.5em; margin: 2em 0 1.2em; padding: 0.6em 1em; background: #f5f7fa; border-left: 6px solid #2563eb; color: #111; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); } /* H3-H5:渐进缩小 */ .note2any h3, .note2any h4, .note2any h5 { background: #f7f9fb; color: #244b74; padding: 0.7em 1.2em 0.7em 1.35em; } .note2any h3 { font-size: 1.25em; } .note2any h4 { font-size: 1.1em; } .note2any h5 { font-size: 1em; } /* 列表 */ .note2any ul, .note2any ol { margin: 1.2em 0 1.2em 1.4em; padding: 0; } .note2any li { margin: 0.4em 0; line-height: 1.6; } .note2any li p { margin: 0.5em 0; } /* 链接 */ .note2any a { color: #576b95; text-decoration: none; border-bottom: 1px solid rgba(87,107,149,0.3); padding-bottom: 1px; } /* 引用:清晰专业的样式 */ .note2any blockquote { background: #f7f7f7; border-left: 4px solid #07c160; margin: 1.5em 0; padding: 1em 1em; color: #444; font-size: 0.95em; } .note2any blockquote p { margin: 0.6em 0; } .note2any blockquote p:first-child { margin-top: 0; } .note2any blockquote p:last-child { margin-bottom: 0; } /* 代码块:清晰易读 */ .note2any pre { background: #f6f8fa !important; border-radius: 5px; overflow-x: auto; border: 1px solid #e8e8e8 !important; } .note2any pre code { display: block; background: transparent !important; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 0.87em; line-height: 1.6; color: #333; border: none !important; } /* 行内代码 */ .note2any code:not(pre code) { background: #f6f8fa; padding: 2px 4px; border-radius: 3px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 0.87em; color: #d14; border: 1px solid #eee; } /* 表格整体:连贯圆角边框 */ .note2any table { width: 100%; border-collapse: collapse; /* 合并边框,避免断开 */ margin: 1.8em 0; font-size: 0.9em; border: 1px solid #e0e0e0; /* 整体外框 */ border-radius: 12px; /* 圆角 */ overflow: hidden; /* 确保圆角生效 */ } /* 单元格 */ .note2any th, .note2any td { border: 1px solid #e0e0e0; /* 内部网格线 */ padding: 8px 10px; text-align: left; line-height: 1.5; } /* 表头 */ .note2any thead th { background: #e8f5e9; font-weight: 600; color: #333; } /* 隔行条纹 */ .note2any tbody tr:nth-child(even) { background: #fafafa; } /* 表格整体 */ .note2any table { width: 100%; border-collapse: collapse; margin: 1.8em 0; font-size: 0.9em; border: 1px solid #e0e0e0; border-radius: 12px; overflow: hidden; } /* 单元格 */ .note2any th, .note2any td { border: 1px solid #e0e0e0; padding: 8px 10px; text-align: left; line-height: 1.5; transition: background 0.2s ease; /* 平滑过渡 */ } /* 表头 */ .note2any thead th { background: #e8f5e9; font-weight: 600; color: #333; } /* 隔行条纹 */ .note2any tbody tr:nth-child(even) { background: #fafafa; } /* hover 效果 */ .note2any tbody tr:hover { background: #f1f8ff; /* 微蓝色高亮 */ } /* 图片与图注 */ .note2any img { max-width: 100%; display: block; margin: 1.5em auto; border-radius: 4px; } .note2any figcaption { text-align: center; font-size: 0.8em; color: #888; margin-top: -0.2em; margin-bottom: 1.5em; } /* 分隔线 */ .note2any hr { border: 0; height: 1px; background: #e3e3e3; margin: 2.5em 0; } /* 彩色标注块(预处理产生的 ||r/g/b/y ) */ .note2any p[data-color-block] { border-radius: 5px; padding: 0.8em 1em; margin: 1.5em 0; font-size: 0.93em; line-height: 1.6; } .note2any p[data-color-block="r"] { background: #ffebee; border-left: 4px solid #ef5350; } .note2any p[data-color-block="g"] { background: #e8f5e9; border-left: 4px solid #4caf50; } .note2any p[data-color-block="b"] { background: #e3f2fd; border-left: 4px solid #2196f3; } .note2any p[data-color-block="y"] { background: #fff8e1; border-left: 4px solid #ffca28; } /* 专业标注提示 */ .note2any p[data-note-type="tip"], .note2any p[data-note-type="info"], .note2any p[data-note-type="warning"], .note2any p[data-note-type="danger"] { border-radius: 5px; padding: 0.8em 1em; margin: 1.5em 0; font-size: 0.93em; } .note2any p[data-note-type="tip"] { background: #e8f5e9; border-left: 4px solid #4caf50; } .note2any p[data-note-type="info"] { background: #e3f2fd; border-left: 4px solid #2196f3; } .note2any p[data-note-type="warning"] { background: #fff8e1; border-left: 4px solid #ffca28; } .note2any p[data-note-type="danger"] { background: #ffebee; border-left: 4px solid #ef5350; } /* 特殊标注:重要/注意/提示 */ .note2any p:has(strong:first-child:contains("💡")) { background: #e8f5e9; border-left: 4px solid #4caf50; border-radius: 5px; padding: 0.8em 1em; margin: 1.5em 0; } .note2any p:has(strong:first-child:contains("⚠️")) { background: #fff8e1; border-left: 4px solid #ffca28; border-radius: 5px; padding: 0.8em 1em; margin: 1.5em 0; } .note2any p:has(strong:first-child:contains("✅")) { background: #e3f2fd; border-left: 4px solid #2196f3; border-radius: 5px; padding: 0.8em 1em; margin: 1.5em 0; } /* 首段紧贴标题 */ .note2any h1 + p, .note2any h2 + p, .note2any h3 + p { margin-top: 0.7em; } /* 专业编程文章必备:行号提示标记 */ .note2any .line-numbers { font-size: 0.8em; color: #999; margin-right: 0.5em; user-select: none; } /* 确保兼容微信的富文本环境 */ .note2any pre code * { font-family: Menlo, Monaco, Consolas, "Courier New", monospace !important; } /* 适配微信公众号的粗体强调 */ .note2any strong { font-weight: 600; color: #1322c5; } /* 行内高亮 */ .note2any mark { background: #fff8dc; padding: 0 2px; } /* 确保代码块内部的空格不会被压缩 */ .note2any pre code { white-space: pre !important; }