feat:1、优化GFM列表按钮样式

2、优化引用块样式
3、增加锚节点语法支持
pull/358/head
lifei6671 2018-09-04 15:28:08 +08:00
parent 369bbdd0b3
commit ecaf0b8c37
4 changed files with 34 additions and 45 deletions

View File

@ -20,9 +20,6 @@
text-align: left
}
.editormd-preview-container blockquote, .editormd-html-preview blockquote{
font-style: normal;
}
.editormd-preview-container table th {
background-color: #f2f2f2;
color: #333;

View File

@ -3259,7 +3259,7 @@
}
.markdown-body a {
color: #4183c4;
color: #08c;
text-decoration: none;
}
@ -3834,19 +3834,16 @@
background-color: #fff;
}
.editormd-preview-container blockquote, .editormd-html-preview blockquote {
color: #666;
border-left: 4px solid #ddd;
padding-left: 20px;
margin-left: 0;
color: #2C3E50;
border-left: 5px solid #D6DBDF;
font-size: 14px;
font-style: italic;
}
.editormd-preview-container blockquote.default, .editormd-html-preview blockquote.default {
border-left: 5px solid #D0E3F0;
background: none repeat scroll 0 0 rgba(102,128,153,.05);
margin: 8px 0;
padding: 8px 16px;
background-color: #F0F7FD;
color: #0382AD;
}
.editormd-preview-container blockquote.default, .editormd-html-preview blockquote.default {
}
.editormd-preview-container blockquote.info, .editormd-html-preview blockquote.info {
border-left-color: #5bc0de;

View File

@ -3118,13 +3118,12 @@
background-color: #fff;
}
.editormd-preview-container blockquote, .editormd-html-preview blockquote {
color: #666;
border-left: 4px solid #ddd;
padding-left: 20px;
margin-left: 0;
color: #2C3E50;
border-left: 4px solid #D6DBDF;
font-size: 14px;
font-style: italic;
line-height:1.7em;
background: none repeat scroll 0 0 rgba(102,128,153,.05);
margin: 8px 0;
padding: 8px 16px;
}
.editormd-preview-container p code, .editormd-html-preview p code {
margin-left: 5px;
@ -3189,14 +3188,6 @@
font-family: "YaHei Consolas Hybrid", Consolas, "Microsoft YaHei", "Malgun Gothic", "Segoe UI", Helvetica, Arial !important;
}
.editormd-preview-container blockquote.default, .editormd-html-preview blockquote.default {
border-left: 5px solid #D0E3F0;
margin: 8px 0;
padding: 8px 16px;
background-color: #F0F7FD;
color: #0382AD;
font-size: 14px;
}
.editormd-preview-container blockquote.info, .editormd-html-preview blockquote.info {
border-left-color: #5bc0de;
color: #5bc0de;

View File

@ -3472,36 +3472,31 @@
var pageBreakReg = regexs.pageBreak;
markedRenderer.blockquote = function($quote) {
console.log($quote)
var quoteBegin = "";
var ps = $quote.match(/<p\s.*?>/i);
if(ps !== null) {
quoteBegin = ps[0];
$quote = $quote.substr(quoteBegin.length);
}
var $class = "default";
if($quote.indexOf("[info]") === 0){
$class = "info";
$quote = $quote.substr(6);
}else if($quote.indexOf("<p>[info]") === 0){
$class = "info";
$quote = $quote.substr(9);
}else if($quote.indexOf("[warning]") === 0){
$class = "warning";
$quote = $quote.substr(9);
}else if($quote.indexOf("<p>[warning]") === 0){
$class = "warning";
$quote = $quote.substr(12);
}else if($quote.indexOf("[success]") === 0){
$class = "success";
$quote = $quote.substr(9);
}else if($quote.indexOf("<p>[success]") === 0){
$class = "success";
$quote = $quote.substr(12);
}else if($quote.indexOf("[danger]") === 0){
$class = "danger";
$quote = $quote.substr(8);
}else if($quote.indexOf("<p>[danger]") === 0){
$class = "danger";
$quote = $quote.substr(11);
}
return '<blockquote class="'+$class+'">\n' + $quote + '</blockquote>\n';
return '<blockquote class="'+$class+'">\n' + quoteBegin + $quote + '</blockquote>\n';
};
markedRenderer.image = function(href,title,text) {
@ -3524,7 +3519,7 @@
attr += " height=\"" + attrs[1] + "\""
}
}
attrs = a.hash.match(/align=center|left|right/i)
attrs = a.hash.match(/align=(center|left|right)/i)
if (attrs !== null) {
var hash = a.hash.replace(attrs[0],"");
if (hash.indexOf("#&") === 0) {
@ -3625,7 +3620,7 @@
});
text = text.replace(atLinkReg, function($1, $2) {
return "<a href=\"" + editormd.urls.atLinkBase + "" + $2 + "\" title=\"&#64;" + $2 + "\" class=\"at-link\">" + $1 + "</a>";
return "<a href=\"" + editormd.urls.atLinkBase + "" + $2 + "\" title=\"&#64;" + $2 + "\" class=\"at-link\" target='_blank'>" + $1 + "</a>";
}).replace(/_#_&#64;_#_/g, "@");
}
@ -3655,8 +3650,14 @@
return "";
}
}
if(href.indexOf("@") === 0){
return '<a name="'+ href.substr(1) + '"></a>';
}
var out = "<a href=\"" + href + "\"";
if(href.indexOf("http://") === 0 || href.indexOf("https://") === 0) {
out += "target=\"_blank\"";
}
if (atLinkReg.test(title) || atLinkReg.test(text))
{
@ -3732,7 +3733,7 @@
markedRenderer.paragraph = function(text) {
var isTeXInline = /\$\$(.*)\$\$/g.test(text);
var isTeXLine = /^\$\$(.*)\$\$$/.test(text);
var isTeXAddClass = (isTeXLine) ? " class=\"" + editormd.classNames.tex + "\"" : "";
var isTeXAddClass = (isTeXLine) ? " class=\"" + editormd.classNames.tex + "\"" : " class=\"line\"";
var isToC = (settings.tocm) ? /^(\[TOC\]|\[TOCM\])$/.test(text) : /^\[TOC\]$/.test(text);
var isToCMenu = /^\[TOCM\]$/.test(text);
@ -3805,6 +3806,9 @@
return "<li>" + this.atLink(this.emoji(text)) + "</li>";
}
};
markedRenderer.checkbox = function(checked){
return checked ? '<i class="fa fa-check-square"></i> ' : '<i class="fa fa-square-o"></i> ';
};
return markedRenderer;
};