From 77506f93bba512654eed6c05dd2fee488f67f206 Mon Sep 17 00:00:00 2001 From: yanglbme Date: Wed, 18 Dec 2019 22:23:15 +0800 Subject: [PATCH] style: fix custom css MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复样式错误 --- README.md | 3 +- assets/scripts/themes/default-theme-css.js | 46 ++++++++++------------ assets/scripts/util.js | 9 +---- 3 files changed, 23 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index abb3c16..ba29fd6 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Markdown 文档自动即时渲染为微信图文,让你不再为微信文章 - [x] 支持色盘取色,并一键替换颜色 - [x] 支持链接微信图文,外链自动转为文末索引 - [x] 支持一键复制并粘贴到公众号后台 -- [x] 支持图片上传并将 URL 插入编辑器光标定位处 +- [x] 支持多图上传并将 URL 插入编辑器光标定位处 - [x] 支持自定义 CSS 样式并实时渲染 - [x] 支持一键恢复至默认内容及样式 - [x] 支持打开或关闭引用链接的选项 @@ -42,6 +42,7 @@ Markdown 文档自动即时渲染为微信图文,让你不再为微信文章 ## 示例文章 - [ES6 特性快速扫盲](https://mp.weixin.qq.com/s/I3EzOO0skf8xDCGtyYM5Lg) +- [免费且好用的图床,就你了,「图壳」!](https://mp.weixin.qq.com/s/0HhgHLo_tTRFZcC-CVjDbw) - [GitHub 项目持续本地化,交给它来做,准没错!](https://mp.weixin.qq.com/s/KO4xHr4EI0YfjF0hiT3pbw) - [阿里又一个 20k+ stars 开源项目诞生,恭喜 fastjson!](https://mp.weixin.qq.com/s/RNKDCK2KoyeuMeEs6GUrow) - [全球最大的成人网站 Pornhub 2019 年度报告新鲜出炉!](https://mp.weixin.qq.com/s/LY5kOzof1h3I0bw7tCkV1Q) diff --git a/assets/scripts/themes/default-theme-css.js b/assets/scripts/themes/default-theme-css.js index 189c4ac..2b7c58d 100644 --- a/assets/scripts/themes/default-theme-css.js +++ b/assets/scripts/themes/default-theme-css.js @@ -2,46 +2,40 @@ const DEFAULT_CSS_CONTENT = `/* 按Ctrl+F可格式化 */ -/* 一级标题 */ +/* 一级标题样式 */ h1 { } -/* 二级标题 */ +/* 二级标题样式 */ h2 { } -/* 三级标题 */ +/* 三级标题样式 */ h3 { } -h4{ -} -/* 段落 */ -p { -} -blockquote { -} -blockquote_p { -} -code { +/* 四级标题样式 */ +h4 { } +/* 图片样式 */ image { } -image_org{ -} -/* 无序列表 */ -ol { -} -ul { -} -/* 引用 */ +/* 引用样式 */ blockquote { } -/* 行内样式 */ -table { +/* 引用段落样式 */ +blockquote_p { } -thead { +/* 段落样式 */ +p { } +/* 行内代码样式 */ +codespan { +} +/* 粗体样式 */ strong { } -/* 脚注文字 */ -footnote { +/* 链接样式 */ +link { +} +/* 微信链接样式 */ +wx_link { } ` \ No newline at end of file diff --git a/assets/scripts/util.js b/assets/scripts/util.js index 0ffa3b1..fe04fee 100644 --- a/assets/scripts/util.js +++ b/assets/scripts/util.js @@ -29,18 +29,11 @@ function customCssWithTemplate(jsonString, color) { custom_theme.block.p = Object.assign(custom_theme.block.p, jsonString.p); custom_theme.block.blockquote = Object.assign(custom_theme.block.blockquote, jsonString.blockquote); custom_theme.block.blockquote_p = Object.assign(custom_theme.block.blockquote_p, jsonString.blockquote_p); - custom_theme.block.code = Object.assign(custom_theme.block.code, jsonString.code); custom_theme.block.image = Object.assign(custom_theme.block.image, jsonString.image); - custom_theme.block.ol = Object.assign(custom_theme.block.ol, jsonString.ol); - custom_theme.block.ul = Object.assign(custom_theme.block.ul, jsonString.ul); - custom_theme.block.footnotes = Object.assign(custom_theme.block.footnotes, jsonString.footnotes); - custom_theme.block.figure = Object.assign(custom_theme.block.figure, jsonString.figure); // inline custom_theme.inline.strong = Object.assign(custom_theme.inline.strong, jsonString.strong); - custom_theme.inline.table = Object.assign(custom_theme.inline.table, jsonString.table); - custom_theme.inline.thead = Object.assign(custom_theme.inline.thead, jsonString.thead); - custom_theme.inline.strong = Object.assign(custom_theme.inline.strong, jsonString.strong); + custom_theme.inline.codespan = Object.assign(custom_theme.inline.codespan, jsonString.codespan); custom_theme.inline.link = Object.assign(custom_theme.inline.link, jsonString.link); custom_theme.inline.wx_link = Object.assign(custom_theme.inline.wx_link, jsonString.wx_link);