diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..350ab51 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +*.js +*.vue \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 3e7e7d0..49c2e6d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,8 @@ module.exports = { rules: { 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', - 'camelcase': 'off' + 'camelcase': 'off', + 'eqeqeq': 'off' }, parserOptions: { parser: 'babel-eslint' diff --git a/public/assets/scripts/sync-scroll.js b/public/assets/scripts/sync-scroll.js index c9e31bb..c2f1231 100644 --- a/public/assets/scripts/sync-scroll.js +++ b/public/assets/scripts/sync-scroll.js @@ -1,23 +1,23 @@ // 左右栏同步滚动 $(document).ready(() => { - let timeout; - $('div.CodeMirror-scroll, #preview').on("scroll", function callback() { - clearTimeout(timeout); + let timeout + $('div.CodeMirror-scroll, #preview').on('scroll', function callback () { + clearTimeout(timeout) - let source = $(this), - target = $(source.is("#preview") ? 'div.CodeMirror-scroll' : '#preview'); + let source = $(this) + let target = $(source.is('#preview') ? 'div.CodeMirror-scroll' : '#preview') - target.off("scroll"); + target.off('scroll') - let source0 = source[0]; - let target0 = target[0]; + let source0 = source[0] + let target0 = target[0] - let percentage = source0.scrollTop / (source0.scrollHeight - source0.offsetHeight); - let height = percentage * (target0.scrollHeight - target0.offsetHeight); - target0.scrollTo(0, height); + let percentage = source0.scrollTop / (source0.scrollHeight - source0.offsetHeight) + let height = percentage * (target0.scrollHeight - target0.offsetHeight) + target0.scrollTo(0, height) timeout = setTimeout(() => { - target.on("scroll", callback); - }, 100); - }); -}); + target.on('scroll', callback) + }, 100) + }) +}) diff --git a/public/assets/scripts/themes/default-theme.js b/public/assets/scripts/themes/default-theme.js index c58c587..a17e20b 100644 --- a/public/assets/scripts/themes/default-theme.js +++ b/public/assets/scripts/themes/default-theme.js @@ -1,177 +1,177 @@ -let default_theme = { - BASE: { - 'text-align': 'left', - 'color': '#3f3f3f', - 'line-height': '1.75', +export const default_theme = { + BASE: { + 'text-align': 'left', + 'color': '#3f3f3f', + 'line-height': '1.75' + }, + BASE_BLOCK: { + 'margin': '1em 8px' + }, + block: { + // 一级标题样式 + h1: { + 'font-size': '1.2em', + 'text-align': 'center', + 'font-weight': 'bold', + 'display': 'table', + 'margin': '2em auto 1em', + 'padding': '0 1em', + 'border-bottom': '2px solid rgba(0, 152, 116, 0.9)' }, - BASE_BLOCK: { - 'margin': '1em 8px' + + // 二级标题样式 + h2: { + 'font-size': '1.2em', + 'text-align': 'center', + 'font-weight': 'bold', + 'display': 'table', + 'margin': '4em auto 2em', + 'padding': '0 0.2em', + 'background': 'rgba(0, 152, 116, 0.9)', + 'color': '#fff' }, - block: { - // 一级标题样式 - h1: { - 'font-size': '1.2em', - 'text-align': 'center', - 'font-weight': 'bold', - 'display': 'table', - 'margin': '2em auto 1em', - 'padding': '0 1em', - 'border-bottom': '2px solid rgba(0, 152, 116, 0.9)' - }, - // 二级标题样式 - h2: { - 'font-size': '1.2em', - 'text-align': 'center', - 'font-weight': 'bold', - 'display': 'table', - 'margin': '4em auto 2em', - 'padding': '0 0.2em', - 'background': 'rgba(0, 152, 116, 0.9)', - 'color': '#fff' - }, - - // 三级标题样式 - h3: { - 'font-weight': 'bold', - 'font-size': '1.1em', - 'margin': '2em 8px 0.75em 0', - 'line-height': '1.2', - 'padding-left': '8px', - 'border-left': '3px solid rgba(0, 152, 116, 0.9)' - }, - - // 四级标题样式 - h4: { - 'font-weight': 'bold', - 'font-size': '1em', - 'margin': '2em 8px 0.5em', - 'color': 'rgba(66, 185, 131, 0.9)' - }, - - // 段落样式 - p: { - 'margin': '1.5em 8px', - 'letter-spacing': '0.1em' - }, - - // 引用样式 - blockquote: { - 'font-style': 'normal', - 'border-left': 'none', - 'padding': '1em', - 'border-radius': '4px', - 'color': '#FEEEED', - 'background': 'rgba(27,31,35,.05)', - 'margin': '2em 8px' - }, - - blockquote_p: { - 'letter-spacing': '0.1em', - 'color': 'rgb(80, 80, 80)', - 'font-family': 'PingFangSC-light, PingFangTC-light, Open Sans, Helvetica Neue, sans-serif', - 'font-size': '1em', - 'display': 'inline', - }, - - code: { - 'font-size': '80%', - 'overflow': 'auto', - 'color': '#333', - 'background': 'rgb(247, 247, 247)', - 'border-radius': '2px', - 'padding': '10px', - 'line-height': '1.5', - 'border': '1px solid rgb(236,236,236)', - 'margin': '20px 0', - }, - - image: { - 'border-radius': '4px', - 'display': 'block', - 'margin': '0.1em auto 0.5em', - 'width': '100% !important', - }, - - image_org: { - 'border-radius': '4px', - 'display': 'block' - }, - - ol: { - 'margin-left': '0', - 'padding-left': '1em' - }, - - ul: { - 'margin-left': '0', - 'padding-left': '1em', - 'list-style': 'circle' - }, - - footnotes: { - 'margin': '0.5em 8px', - 'font-size': '80%' - }, - - figure: { - 'margin': '1.5em 8px', - } + // 三级标题样式 + h3: { + 'font-weight': 'bold', + 'font-size': '1.1em', + 'margin': '2em 8px 0.75em 0', + 'line-height': '1.2', + 'padding-left': '8px', + 'border-left': '3px solid rgba(0, 152, 116, 0.9)' }, - inline: { - listitem: { - 'text-indent': '-1em', - 'display': 'block', - 'margin': '0.2em 8px' - }, - codespan: { - 'font-size': '90%', - 'color': '#d14', - 'background': 'rgba(27,31,35,.05)', - 'padding': '3px 5px', - 'border-radius': '4px', - }, + // 四级标题样式 + h4: { + 'font-weight': 'bold', + 'font-size': '1em', + 'margin': '2em 8px 0.5em', + 'color': 'rgba(66, 185, 131, 0.9)' + }, - link: { - 'color': '#576b95' - }, + // 段落样式 + p: { + 'margin': '1.5em 8px', + 'letter-spacing': '0.1em' + }, - wx_link: { - 'color': '#576b95', - 'text-decoration': 'none', - }, + // 引用样式 + blockquote: { + 'font-style': 'normal', + 'border-left': 'none', + 'padding': '1em', + 'border-radius': '4px', + 'color': '#FEEEED', + 'background': 'rgba(27,31,35,.05)', + 'margin': '2em 8px' + }, - // 字体加粗样式 - strong: { - 'color': 'rgba(15, 76, 129, 0.9)', - 'font-weight': 'bold', - }, + blockquote_p: { + 'letter-spacing': '0.1em', + 'color': 'rgb(80, 80, 80)', + 'font-family': 'PingFangSC-light, PingFangTC-light, Open Sans, Helvetica Neue, sans-serif', + 'font-size': '1em', + 'display': 'inline' + }, - table: { - 'border-collapse': 'collapse', - 'text-align': 'center', - 'margin': '1em 8px' - }, + code: { + 'font-size': '80%', + 'overflow': 'auto', + 'color': '#333', + 'background': 'rgb(247, 247, 247)', + 'border-radius': '2px', + 'padding': '10px', + 'line-height': '1.5', + 'border': '1px solid rgb(236,236,236)', + 'margin': '20px 0' + }, - thead: { - 'background': 'rgba(0, 0, 0, 0.05)', - 'font-weight': 'bold' - }, + image: { + 'border-radius': '4px', + 'display': 'block', + 'margin': '0.1em auto 0.5em', + 'width': '100% !important' + }, - td: { - 'border': '1px solid #dfdfdf', - 'padding': '0.25em 0.5em' - }, + image_org: { + 'border-radius': '4px', + 'display': 'block' + }, - footnote: { - 'font-size': '12px' - }, + ol: { + 'margin-left': '0', + 'padding-left': '1em' + }, - figcaption: { - 'text-align': 'center', - 'color': '#888', - 'font-size': '0.8em' - } + ul: { + 'margin-left': '0', + 'padding-left': '1em', + 'list-style': 'circle' + }, + + footnotes: { + 'margin': '0.5em 8px', + 'font-size': '80%' + }, + + figure: { + 'margin': '1.5em 8px' } -}; \ No newline at end of file + }, + inline: { + listitem: { + 'text-indent': '-1em', + 'display': 'block', + 'margin': '0.2em 8px' + }, + + codespan: { + 'font-size': '90%', + 'color': '#d14', + 'background': 'rgba(27,31,35,.05)', + 'padding': '3px 5px', + 'border-radius': '4px' + }, + + link: { + 'color': '#576b95' + }, + + wx_link: { + 'color': '#576b95', + 'text-decoration': 'none' + }, + + // 字体加粗样式 + strong: { + 'color': 'rgba(15, 76, 129, 0.9)', + 'font-weight': 'bold' + }, + + table: { + 'border-collapse': 'collapse', + 'text-align': 'center', + 'margin': '1em 8px' + }, + + thead: { + 'background': 'rgba(0, 0, 0, 0.05)', + 'font-weight': 'bold' + }, + + td: { + 'border': '1px solid #dfdfdf', + 'padding': '0.25em 0.5em' + }, + + footnote: { + 'font-size': '12px' + }, + + figcaption: { + 'text-align': 'center', + 'color': '#888', + 'font-size': '0.8em' + } + } +} diff --git a/public/index.html b/public/index.html index 5d50505..fdf725d 100644 --- a/public/index.html +++ b/public/index.html @@ -46,8 +46,8 @@ - - + + @@ -59,41 +59,21 @@
-扫码关注我的公众号,原创技术文章第一时间推送!
+ +
- For a guide and recipes on how to configure / customize this project,
- check out the
- vue-cli documentation.
-