This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化Prism样式;修复meditor转化html为md时代码块的处理bug

old
宇天 2018-05-20 06:20:19 +08:00
parent 869dc40ab3
commit 4e09ca95f3
3 changed files with 38 additions and 40 deletions

View File

@ -108,8 +108,8 @@ const ELEMS = {
strong: function(str, attr, inner) { strong: function(str, attr, inner) {
return (inner && '**' + inner + '**') || '' return (inner && '**' + inner + '**') || ''
}, },
pre: function(str, attr, inner) { pre: function(str, attr, inner) {
inner = inner.replace(/<[/]?code>/g, '')
return '\n\n```\n' + inner + '\n```\n' return '\n\n```\n' + inner + '\n```\n'
}, },
code: function(str, attr, inner) { code: function(str, attr, inner) {
@ -174,9 +174,6 @@ function html2md(str) {
} }
} else { } else {
str = str.replace(exp, cb) str = str.replace(exp, cb)
if (i === 'pre') {
str = str.replace(/<[/]?code>/g, '')
}
} }
// 对另外3种同类标签做一次处理 // 对另外3种同类标签做一次处理

View File

@ -777,10 +777,11 @@ Prism.languages.js = Prism.languages.javascript
inside: insideString inside: insideString
} }
], ],
params: / (-[\w]+)/,
variable: insideString.variable, variable: insideString.variable,
// Originally based on http://ss64.com/bash/ // Originally based on http://ss64.com/bash/
function: { 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 lookbehind: true
}, },
keyword: { keyword: {
@ -859,7 +860,7 @@ Prism.languages.yaml = {
important: /[&*][\w]+/, important: /[&*][\w]+/,
punctuation: /---|[:[\]{}\-,|>?]|\.\.\./ punctuation: /---|[:[\]{}\-,|>?]|\.\.\./
} }
Prism.languages.other = {} Prism.languages.other = Prism.languages.clike
window.Prism = Prism window.Prism = Prism
export default Prism export default Prism

View File

@ -6,44 +6,44 @@
* *
*/ */
@import 'var.scss';
/*代码块*/ /*代码块*/
.do-ui-blockcode {position: relative;border: 1px solid #ddd;margin: 15px 0;padding: 8px 0;line-height: 1.5;background: #fafafa; .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;
.c-comment{color: #8e908c;font-style:italic;}
.c-smartyx {color: #607d8b;}
.c-important {color: #f5871f;font-style:italic;}
.c-punctuation {color: #986756;}
.c-regex {color: #c82829;}
.c-boolean,
.c-number,.c-params {color: #f5871f;}
.c-function {color:#009688;}
.c-class-name,
.c-build-in {color:#3aa9f3;}
.c-class-name,
.c-build-in {font-style:italic;font-weight:bold;}
.c-attr-name,
.c-property {color: #c79f0f;font-weight:bold;}
/*语法高亮*/ .c-string,
.lang {position: relative;display: block;padding: 0 8px;color: #383a42;word-wrap: break-word;white-space: pre-wrap;font-family: Courier; .c-attr-value {color: #5ab302;}
.c-comment{color: #8e908c;font-style:italic;} .c-tag,
.c-smartyx {color: #607d8b;} .c-keyword,
.c-important {color: #f5871f;font-style:italic;} .c-selector,
.c-punctuation {color: #986756;} .c-operator {color: #d81406;}
.c-regex {color: #c82829;}
.c-boolean, .c-keyword,.c-params,.c-property {font-style:italic;}
.c-number {color: #f5871f;} }
.c-function {color:#009688;}
.c-class-name,
.c-build-in {color:#3aa9f3;}
.c-class-name,
.c-build-in {font-style:italic;font-weight:bold;}
.c-attr-name,
.c-property {color: #c79f0f;font-weight:bold;}
.c-property {font-style:italic;}
.c-string,
.c-attr-value {color: #5ab302;}
.c-tag,
.c-keyword,
.c-selector,
.c-operator {color: #d81406;}
.c-keyword {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;}