Merge pull request #46 from yun-percy/master
[require]添加代码块行号,以及monokai主题
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
"LogoPath": "/static/images/zhr.jpg",
|
"LogoPath": "/static/images/zhr.jpg",
|
||||||
"PageSize": "10",
|
"PageSize": "10",
|
||||||
"ExpandMenu": "true",
|
"ExpandMenu": "true",
|
||||||
"ShowArticleSign": "false",
|
"ShowArticleSign": "true",
|
||||||
"Editor": "",
|
"Editor": "",
|
||||||
"CacheExpired": "300",
|
"CacheExpired": "300",
|
||||||
"TranslateKey": "y2RIaF6RifHnJeD1Szzw",
|
"TranslateKey": "y2RIaF6RifHnJeD1Szzw",
|
||||||
@@ -18,5 +18,6 @@
|
|||||||
"ShowComments": "true",
|
"ShowComments": "true",
|
||||||
"ShowGuestbook": "true",
|
"ShowGuestbook": "true",
|
||||||
"ChangyanId": "cyrUoGjWj",
|
"ChangyanId": "cyrUoGjWj",
|
||||||
"ChangyanConf": "prod_c77d5188bc137c8d9181720d02506ab6"
|
"ChangyanConf": "prod_c77d5188bc137c8d9181720d02506ab6",
|
||||||
|
"CodeTheme": ""
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,8 @@
|
|||||||
"message_id": "友言uid",
|
"message_id": "友言uid",
|
||||||
"message_id_placeholder": "apply uid",
|
"message_id_placeholder": "apply uid",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"editor": "Default Editor"
|
"editor": "Default Editor",
|
||||||
|
"code_theme":"Code Block Theme"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,7 +209,8 @@
|
|||||||
"author_name": "网站所有者",
|
"author_name": "网站所有者",
|
||||||
"author_name_placeholder": "网站所有者",
|
"author_name_placeholder": "网站所有者",
|
||||||
"email_addr": "邮箱",
|
"email_addr": "邮箱",
|
||||||
"email_addr_placeholder": "邮件地址"
|
"email_addr_placeholder": "邮件地址",
|
||||||
|
"code_theme": "代码块风格"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
13
public/css/dark_theme_code.css
Normal file
13
public/css/dark_theme_code.css
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
pre{
|
||||||
|
background: transparent url(/static/images/code-bk.png) repeat scroll 0% 0%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 15px 20px;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #eee;
|
||||||
|
border-width: 1px 0;
|
||||||
|
border-radius: 3px;
|
||||||
|
overflow: auto;
|
||||||
|
color: #f8f8f2;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 19.2px;
|
||||||
|
}
|
||||||
1
public/css/monokai-sublime.min.css
vendored
Normal file
1
public/css/monokai-sublime.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.hljs{display:block;overflow-x:auto;padding:0.5em;background:#23241f}.hljs,.hljs-tag,.hljs-subst{color:#f8f8f2}.hljs-strong,.hljs-emphasis{color:#a8a8a2}.hljs-bullet,.hljs-quote,.hljs-number,.hljs-regexp,.hljs-literal,.hljs-link{color:#ae81ff}.hljs-code,.hljs-title,.hljs-section,.hljs-selector-class{color:#a6e22e}.hljs-strong{font-weight:bold}.hljs-emphasis{font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-name,.hljs-attr{color:#f92672}.hljs-symbol,.hljs-attribute{color:#66d9ef}.hljs-params,.hljs-class .hljs-title{color:#f8f8f2}.hljs-string,.hljs-type,.hljs-built_in,.hljs-builtin-name,.hljs-selector-id,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-addition,.hljs-variable,.hljs-template-variable{color:#e6db74}.hljs-comment,.hljs-deletion,.hljs-meta{color:#75715e}
|
||||||
@@ -18,4 +18,61 @@
|
|||||||
border-radius: .8rem;
|
border-radius: .8rem;
|
||||||
background: #49b1f5;
|
background: #49b1f5;
|
||||||
content: "";
|
content: "";
|
||||||
|
}
|
||||||
|
.hljs {
|
||||||
|
border: 0;
|
||||||
|
font-family: "Consulas", "Courier New", Courier, mono, serif;
|
||||||
|
font-size: 12px;
|
||||||
|
background: transparent;
|
||||||
|
display: block;
|
||||||
|
padding: 1px;
|
||||||
|
margin: 0;
|
||||||
|
width: 100%;
|
||||||
|
font-weight: 200;
|
||||||
|
color: #333;
|
||||||
|
white-space: pre-wrap
|
||||||
|
}
|
||||||
|
.hljs ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0px;
|
||||||
|
padding-left: 0em!important;
|
||||||
|
}
|
||||||
|
.hljs ul li {
|
||||||
|
list-style: none;
|
||||||
|
font-family: "Consulas", "Courier New", Courier, mono, serif;
|
||||||
|
font-weight: 200;
|
||||||
|
font-size: 12px;
|
||||||
|
padding-left: 5px!important;
|
||||||
|
margin: 0 !important;
|
||||||
|
line-height: 14px;
|
||||||
|
word-break: break-all;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
.hljs ul li:nth-of-type(even) {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
code.hljs{
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
.hljs ul {
|
||||||
|
list-style-type: none;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs ul li {
|
||||||
|
counter-increment: customlistcounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs ul li:before {
|
||||||
|
content: counter(customlistcounter) " ";
|
||||||
|
/*font-weight: bold;*/
|
||||||
|
float: left;
|
||||||
|
width: 3em;
|
||||||
|
margin-right: 10px;
|
||||||
|
color: #999;
|
||||||
|
border-right: 3px solid #6ce26c !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs ul :first-child {
|
||||||
|
counter-reset: customlistcounter;
|
||||||
}
|
}
|
||||||
BIN
public/images/code-bk.png
Normal file
BIN
public/images/code-bk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
4
public/js/highlight_line_number.js
Normal file
4
public/js/highlight_line_number.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
//代码高亮自定义
|
||||||
|
$("code").each(function(){
|
||||||
|
$(this).html("<ul><li>" + $(this).html().replace(/\n/g,"\n</li><li>") +"\n</li></ul>");
|
||||||
|
});
|
||||||
@@ -563,7 +563,8 @@ router.post('/saveSettings', (req, res, next) => {
|
|||||||
ChangyanId: req.body.ChangyanId,
|
ChangyanId: req.body.ChangyanId,
|
||||||
ChangyanConf: req.body.ChangyanConf,
|
ChangyanConf: req.body.ChangyanConf,
|
||||||
Email:req.body.EmailAddr,
|
Email:req.body.EmailAddr,
|
||||||
Author:req.body.AuthorName
|
Author:req.body.AuthorName,
|
||||||
|
CodeTheme:req.body.CodeTheme
|
||||||
});
|
});
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,6 +80,21 @@ block content
|
|||||||
li(data-value='markdown')
|
li(data-value='markdown')
|
||||||
a(href='#') Markdown
|
a(href='#') Markdown
|
||||||
input#Editor.hidden.hidden-field(type='text', name='Editor', readonly='readonly', aria-hidden='true',value=settings.Editor)
|
input#Editor.hidden.hidden-field(type='text', name='Editor', readonly='readonly', aria-hidden='true',value=settings.Editor)
|
||||||
|
li.list-group-item.clearfix
|
||||||
|
.pull-left
|
||||||
|
| #{__("admin.settings.code_theme")}
|
||||||
|
.pull-right
|
||||||
|
#CodeThemelist.btn-group.selectlist(data-resize='auto', data-initialize='selectlist')
|
||||||
|
button.btn.btn-white.dropdown-toggle(data-toggle='dropdown', type='button')
|
||||||
|
span.selected-label
|
||||||
|
span.caret
|
||||||
|
span.sr-only Toggle Dropdown
|
||||||
|
ul.dropdown-menu(role='menu')
|
||||||
|
li(data-value='')
|
||||||
|
a(href='#') Github
|
||||||
|
li(data-value='Monokai')
|
||||||
|
a(href='#') Monokai
|
||||||
|
input#CodeTheme.hidden.hidden-field(type='text', name='CodeTheme', readonly='readonly', aria-hidden='true',value=settings.CodeTheme)
|
||||||
li.list-group-item.clearfix
|
li.list-group-item.clearfix
|
||||||
.pull-left
|
.pull-left
|
||||||
| #{__("admin.settings.cache_expire_time")}
|
| #{__("admin.settings.cache_expire_time")}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ block content
|
|||||||
|
|
||||||
if (post.ContentType === 'markdown')
|
if (post.ContentType === 'markdown')
|
||||||
link(href='/static/css/github-markdown.css', rel='stylesheet')
|
link(href='/static/css/github-markdown.css', rel='stylesheet')
|
||||||
|
if (settings.CodeTheme==='Monokai')
|
||||||
|
link(href='/static/css/monokai-sublime.min.css', rel='stylesheet')
|
||||||
|
link(href='/static/css/dark_theme_code.css', rel='stylesheet')
|
||||||
.detail-container
|
.detail-container
|
||||||
.container
|
.container
|
||||||
.row
|
.row
|
||||||
@@ -91,6 +94,7 @@ block content
|
|||||||
script(type='text/javascript', src='/static/scrollNav/dist/jquery.scrollNav.min.js', charset='utf-8')
|
script(type='text/javascript', src='/static/scrollNav/dist/jquery.scrollNav.min.js', charset='utf-8')
|
||||||
script(type='text/javascript', src='https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js', charset='utf-8')
|
script(type='text/javascript', src='https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js', charset='utf-8')
|
||||||
script(type='text/javascript', src='/static/js/article.js', charset='utf-8')
|
script(type='text/javascript', src='/static/js/article.js', charset='utf-8')
|
||||||
|
script(type='text/javascript', src='/static/js/highlight_line_number.js', charset='utf-8')
|
||||||
script.
|
script.
|
||||||
var expandMenu = '#{settings.ExpandMenu}';
|
var expandMenu = '#{settings.ExpandMenu}';
|
||||||
var logoPath = "#{settings.LogoPath}";
|
var logoPath = "#{settings.LogoPath}";
|
||||||
|
|||||||
Reference in New Issue
Block a user