优化Prism样式;修复meditor转化html为md时代码块的处理bug
parent
869dc40ab3
commit
4e09ca95f3
|
@ -108,8 +108,8 @@ const ELEMS = {
|
|||
strong: function(str, attr, inner) {
|
||||
return (inner && '**' + inner + '**') || ''
|
||||
},
|
||||
|
||||
pre: function(str, attr, inner) {
|
||||
inner = inner.replace(/<[/]?code>/g, '')
|
||||
return '\n\n```\n' + inner + '\n```\n'
|
||||
},
|
||||
code: function(str, attr, inner) {
|
||||
|
@ -174,9 +174,6 @@ function html2md(str) {
|
|||
}
|
||||
} else {
|
||||
str = str.replace(exp, cb)
|
||||
if (i === 'pre') {
|
||||
str = str.replace(/<[/]?code>/g, '')
|
||||
}
|
||||
}
|
||||
|
||||
// 对另外3种同类标签做一次处理
|
||||
|
|
|
@ -777,10 +777,11 @@ Prism.languages.js = Prism.languages.javascript
|
|||
inside: insideString
|
||||
}
|
||||
],
|
||||
params: / (-[\w]+)/,
|
||||
variable: insideString.variable,
|
||||
// Originally based on http://ss64.com/bash/
|
||||
function: {
|
||||
pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,
|
||||
pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|npm|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|up|update|upgrade|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/,
|
||||
lookbehind: true
|
||||
},
|
||||
keyword: {
|
||||
|
@ -859,7 +860,7 @@ Prism.languages.yaml = {
|
|||
important: /[&*][\w]+/,
|
||||
punctuation: /---|[:[\]{}\-,|>?]|\.\.\./
|
||||
}
|
||||
Prism.languages.other = {}
|
||||
Prism.languages.other = Prism.languages.clike
|
||||
|
||||
window.Prism = Prism
|
||||
export default Prism
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*代码块*/
|
||||
.do-ui-blockcode {position: relative;border: 1px solid #ddd;margin: 15px 0;padding: 8px 0;line-height: 1.5;background: #fafafa;
|
||||
@import 'var.scss';
|
||||
|
||||
/*代码块*/
|
||||
.do-ui-blockcode {position: relative;margin: 15px 0;padding: 8px 0;line-height: 1.5;border-radius:3px;background: nth($cp, 2);
|
||||
|
||||
/*语法高亮*/
|
||||
.lang {position: relative;display: block;padding: 0 8px;color: #383a42;word-wrap: break-word;white-space: pre-wrap;font-family: Courier;
|
||||
|
@ -20,7 +21,7 @@
|
|||
.c-regex {color: #c82829;}
|
||||
|
||||
.c-boolean,
|
||||
.c-number {color: #f5871f;}
|
||||
.c-number,.c-params {color: #f5871f;}
|
||||
.c-function {color:#009688;}
|
||||
|
||||
.c-class-name,
|
||||
|
@ -32,7 +33,6 @@
|
|||
.c-attr-name,
|
||||
.c-property {color: #c79f0f;font-weight:bold;}
|
||||
|
||||
.c-property {font-style:italic;}
|
||||
|
||||
.c-string,
|
||||
.c-attr-value {color: #5ab302;}
|
||||
|
@ -42,8 +42,8 @@
|
|||
.c-selector,
|
||||
.c-operator {color: #d81406;}
|
||||
|
||||
.c-keyword {font-style:italic;}
|
||||
.c-keyword,.c-params,.c-property {font-style:italic;}
|
||||
}
|
||||
}
|
||||
/*行内代码*/
|
||||
.do-ui-inlinecode {margin:0 2px;padding:0 5px;color:#d14;border:1px solid #ddd;border-radius:3px;}
|
||||
.do-ui-inlinecode {display:inline-block;margin:0 2px;padding:0 5px;line-height: 1.5;color:#d14;background: nth($cp, 2);border-radius:3px;}
|
Reference in New Issue