三门网站制作,wordpress 标签图片,wordpress分类高亮,贵州省住房和城乡建设厅网站报名网或许是我太苛刻了#xff0c;用了博客园默认的SyntaxHighlighter工具高亮代码后#xff0c;总不尽人意。首先是行间距太大#xff0c;这对于只贴小量的代码没什么问题。但如果代码很长#xff0c;将会很大程度上影响阅读效率。其次#xff0c;博客园似乎修改了SyntaxHighl… 或许是我太苛刻了用了博客园默认的SyntaxHighlighter工具高亮代码后总不尽人意。首先是行间距太大这对于只贴小量的代码没什么问题。但如果代码很长将会很大程度上影响阅读效率。其次博客园似乎修改了SyntaxHighlighter原版代码不能自动换行的问题但改得不彻底又引出了新的问题自动换行后会导致行号不连惯并且产生多行注释时的Bug。 但也有改的好的地方比如字体比原来默认的漂亮多了高亮的颜色也更加符合阅读习惯还有就是给代码的行加上了两种不同的背景色交替显示这都让代码看起来舒爽了很多。 最后我还是决定自己动手查找资料上传并修改SyntaxHighlighter源码基本上达到了预期的目标。 1.下载并修改SyntaxHighlighter源码 1.1下载SyntaxHighlighter 可到http://alexgorbatchev.com/SyntaxHighlighter/下载SyntaxHighlighter。我下的是8.0.83版本。 1.2 修改源码 找到styles/shCoreDefault.css文件按照如下方式修改: /*** SyntaxHighlighter* http://alexgorbatchev.com/SyntaxHighlighter** SyntaxHighlighter is donationware. If you are using it, please donate.* http://alexgorbatchev.com/SyntaxHighlighter/donate.html** version* 3.0.83 (July 02 2010)* * copyright* Copyright (C) 2004-2010 Alex Gorbatchev.** license* Dual licensed under the MIT and GPL licenses.*/
.syntaxhighlighter a,
.syntaxhighlighter div,
.syntaxhighlighter code,
.syntaxhighlighter table,
.syntaxhighlighter table td,
.syntaxhighlighter table tr,
.syntaxhighlighter table tbody,
.syntaxhighlighter table thead,
.syntaxhighlighter table caption,
.syntaxhighlighter textarea {-moz-border-radius: 0 0 0 0 !important;-webkit-border-radius: 0 0 0 0 !important;background: none !important;border: 0 !important;bottom: auto !important;float: none !important;height: auto !important;left: auto !important;/* 修改行间距 *//* line-height: 1.1em !important; */line-height: 1.2em !important;margin: 0 !important;outline: 0 !important;overflow: visible !important;padding: 0 !important;position: static !important;right: auto !important;text-align: left !important;top: auto !important;vertical-align: baseline !important;width: auto !important;box-sizing: content-box !important;/* 修改字体类型 *//* font-family: Consolas, Bitstream Vera Sans Mono, Courier New, Courier, monospace !important; */font-family: 新宋体, Courier, monospace !important;font-weight: normal !important;font-style: normal !important;/* 修改字体大小 *//* font-size: 1em !important; */font-size: 13px !important;min-height: inherit !important;min-height: auto !important;
}.syntaxhighlighter {width: 100% !important;margin: 1em 0 1em 0 !important;position: relative !important;overflow: auto !important;/* 修改字体大小此处没明显效果 *//* font-size: 1em !important; */font-size: 13px !important;
}
.syntaxhighlighter.source {overflow: hidden !important;
}
.syntaxhighlighter .bold {font-weight: bold !important;
}
.syntaxhighlighter .italic {font-style: italic !important;
}
.syntaxhighlighter .line {white-space: pre !important;
}
.syntaxhighlighter table {width: 100% !important;/* 给代码加个框框 */border: 1px solid #7FFFD4 !important;
}
.syntaxhighlighter table caption {text-align: left !important;padding: .5em 0 0.5em 1em !important;
}
.syntaxhighlighter table td.code {width: 100% !important;
}
.syntaxhighlighter table td.code .container {position: relative !important;
}
.syntaxhighlighter table td.code .container textarea {box-sizing: border-box !important;position: absolute !important;left: 0 !important;top: 0 !important;width: 100% !important;height: 100% !important;border: none !important;background: white !important;padding-left: 1em !important;overflow: hidden !important;white-space: pre !important;
}
.syntaxhighlighter table td.gutter .line {text-align: right !important;padding: 0 0.5em 0 1em !important;
}
.syntaxhighlighter table td.code .line {padding: 0 1em !important;
}
.syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line {padding-left: 0em !important;
}
.syntaxhighlighter.show {display: block !important;
}
.syntaxhighlighter.collapsed table {display: none !important;
}
.syntaxhighlighter.collapsed .toolbar {padding: 0.1em 0.8em 0em 0.8em !important;font-size: 1em !important;position: static !important;width: auto !important;height: auto !important;
}
.syntaxhighlighter.collapsed .toolbar span {display: inline !important;margin-right: 1em !important;
}
.syntaxhighlighter.collapsed .toolbar span a {padding: 0 !important;display: none !important;
}
.syntaxhighlighter.collapsed .toolbar span a.expandSource {display: inline !important;
}
.syntaxhighlighter .toolbar {position: absolute !important;right: 1px !important;top: 1px !important;width: 11px !important;height: 11px !important;font-size: 10px !important;z-index: 10 !important;
}
.syntaxhighlighter .toolbar span.title {display: inline !important;
}
.syntaxhighlighter .toolbar a {display: block !important;text-align: center !important;text-decoration: none !important;padding-top: 1px !important;
}
.syntaxhighlighter .toolbar a.expandSource {display: none !important;
}
.syntaxhighlighter.ie {font-size: .9em !important;padding: 1px 0 1px 0 !important;
}
.syntaxhighlighter.ie .toolbar {line-height: 8px !important;
}
.syntaxhighlighter.ie .toolbar a {padding-top: 0px !important;
}
.syntaxhighlighter.printing .line.alt1 .content,
.syntaxhighlighter.printing .line.alt2 .content,
.syntaxhighlighter.printing .line.highlighted .number,
.syntaxhighlighter.printing .line.highlighted.alt1 .content,
.syntaxhighlighter.printing .line.highlighted.alt2 .content {background: none !important;
}
.syntaxhighlighter.printing .line .number {color: #bbbbbb !important;
}
.syntaxhighlighter.printing .line .content {color: black !important;
}
.syntaxhighlighter.printing .toolbar {display: none !important;
}
.syntaxhighlighter.printing a {text-decoration: none !important;
}
.syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a {color: black !important;
}
.syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a {color: #008200 !important;
}
.syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a {color: blue !important;
}
.syntaxhighlighter.printing .keyword {color: #006699 !important;font-weight: bold !important;
}
.syntaxhighlighter.printing .preprocessor {color: gray !important;
}
.syntaxhighlighter.printing .variable {color: #aa7700 !important;
}
.syntaxhighlighter.printing .value {color: #009900 !important;
}
.syntaxhighlighter.printing .functions {color: #ff1493 !important;
}
.syntaxhighlighter.printing .constants {color: #0066cc !important;
}
.syntaxhighlighter.printing .script {font-weight: bold !important;
}
.syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a {color: gray !important;
}
.syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a {color: #ff1493 !important;
}
.syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a {color: red !important;
}
.syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a {color: black !important;
}.syntaxhighlighter {background-color: white !important;
}
.syntaxhighlighter .line.alt1 {/* 行颜色交替变换显示设置与下面的alt2配合 *//* background-color: white !important; */background-color: #f8f8f8 !important;
}
.syntaxhighlighter .line.alt2 {background-color: white !important;
}
.syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {background-color: #e0e0e0 !important;
}
.syntaxhighlighter .line.highlighted.number {color: black !important;
}
.syntaxhighlighter table caption {color: black !important;
}
.syntaxhighlighter .gutter {color: #afafaf !important;
}
.syntaxhighlighter .gutter .line {border-right: 3px solid #6ce26c !important;
}
.syntaxhighlighter .gutter .line.highlighted {background-color: #6ce26c !important;color: white !important;
}
.syntaxhighlighter.printing .line .content {border: none !important;
}
.syntaxhighlighter.collapsed {overflow: visible !important;
}
.syntaxhighlighter.collapsed .toolbar {color: blue !important;background: white !important;border: 1px solid #6ce26c !important;
}
.syntaxhighlighter.collapsed .toolbar a {color: blue !important;
}
.syntaxhighlighter.collapsed .toolbar a:hover {color: red !important;
}
.syntaxhighlighter .toolbar {/* 去掉右上角的小问号(2-1),应根据行交替显示的颜色设置该选项 *//* color: white !important; *//* background: #6ce26c !important; */color: white !important;background: white !important;border: none !important;
}
.syntaxhighlighter .toolbar a {/* 2-2去掉右上角的小问号(2-2) *//* color: white !important; */color:white !important;
}
.syntaxhighlighter .toolbar a:hover {color: black !important;
}
.syntaxhighlighter .plain, .syntaxhighlighter .plain a {color: black !important;
}
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {color: #008200 !important;
}
.syntaxhighlighter .string, .syntaxhighlighter .string a {/* 修改字符串值的颜色 *//* color: blue !important; */color: #a31414 !important;
}
.syntaxhighlighter .keyword {/* 修改关键字的颜色 *//* color: #006699 !important; */color: blue !important;
}
.syntaxhighlighter .preprocessor {/* 修改预处理的颜色 *//* color: gray !important; */color: #02027e !important;
}
.syntaxhighlighter .variable {color: #aa7700 !important;
}
.syntaxhighlighter .value {color: #009900 !important;
}
.syntaxhighlighter .functions {/* 禁止系统函数加粗显示 */font-weight: normal !important; color: #ff1493 !important;
}
.syntaxhighlighter .constants {color: #0066cc !important;
}
.syntaxhighlighter .script {font-weight: bold !important;color: #006699 !important;background-color: none !important;
}
.syntaxhighlighter .color1, .syntaxhighlighter .color1 a {/* 禁止数据类型加粗显示 */font-weight: normal !important; /* 修改数据类型的颜色 *//* color: gray !important; */color: #a300a3 !important;
}
.syntaxhighlighter .color2, .syntaxhighlighter .color2 a {color: #ff1493 !important;
}
.syntaxhighlighter .color3, .syntaxhighlighter .color3 a {color: red !important;
}.syntaxhighlighter .keyword {/* 取消关键字加粗显示 *//* font-weight: bold !important; */font-weight: normal !important;
} 这里并没有添加自动换行的功能暂时先在写博客时手动调整一下单行代码的长度别越界就OK了。 2.上传源码并在Blog中设置 2.1上传文件 需要上传两种类型的文件 css文件将刚刚修改好的shCoreDefault.css上传即可。 js文件shCore.js是必传的另外再可以有选择性的上传你需要的文件。比如我常用C偶尔用css那么就可以只上传shBrushCpp.js和shBrushCss.js两个文件。当然也可以全部js文件都传上去。 如图(我只上传了部分文件) 2.2 设置Blog. 这一步的主要目的是在合适的位置添加合适的源码使你刚刚上传的源码文件发挥作用。你需要在博客园--设置--子标题中添加如图所示代码 全部代码为 script typetext/javascript
srchttp://files.cnblogs.com/chinaxmly/shCore.js/script
script typetext/javascript
srchttp://files.cnblogs.com/chinaxmly/shBrushCpp.js/script
script typetext/javascript
srchttp://files.cnblogs.com/chinaxmly/shBrushCss.js/script
script typetext/javascript
srchttp://files.cnblogs.com/chinaxmly/shBrushXml.js/script
script typetext/javascript
srchttp://files.cnblogs.com/chinaxmly/shBrushJScript.js/script
link typetext/css relstylesheet
hrefhttp://files.cnblogs.com/chinaxmly/shCoreDefault.css/
script typetext/javascriptSyntaxHighlighter.config.strings.help ;SyntaxHighlighter.config.strings.expandSource 查看代码;SyntaxHighlighter.all();
/script 说明 herf和src的值为你的博客地址加文件名称。 “SyntaxHighlighter.config.strings.help “”;”这句话用于去掉代码右上角的小‘’号。 3. 个性化代码风格 将你的代码包含在如下的pre/pre标签中即可 pre classbrush: cpp; highlight: [12, 15]; first-line: 10; html-script: false; light: false; auto-links: false; collapse: true; class-name: class_name_demo;
// 你的代码
/pre 最终的效果如下所示C // 程序初始化仿真#define TRUE 1
#define FALSE 0typedef char* LPSTR;
typedef const char* LPCSTR;#include lt;iostreamgt;using namespace std;///
// Window message map handling
struct AFX_MSGMAP_ENTRY; // declared below after CWndstruct AFX_MSGMAP
{AFX_MSGMAP* pBaseMessageMap;AFX_MSGMAP_ENTRY* lpEntries;
};// DECLARE_MESSAGE_MAP
#define DECLARE_MESSAGE_MAP() \static AFX_MSGMAP_ENTRY _messageEntries[]; \static AFX_MSGMAP messageMap; \virtual AFX_MSGMAP* GetMessageMap() const;/* 多行代码示例 */
class CFrameWnd : public CWnd uuuuuuuuuuuuuuuuuuuuuyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyiuojfosfejosifoefsfijsojuosfa;fslfjeosjfoaifjeojsosjfessfeoij
{
public: CFrameWnd() { }~CFrameWnd() { }virtual BOOL Create();virtual BOOL PreCreateWindow();
};/* 单行注释 *//*
* 多行注释
*/class CView : public CWnd
{
public:CView() { }~CView() { }
};BOOL CWnd::CreateEx()
{int x 7;x;char* Hello World.;PreCreateWindow();// 系统函数ps1 (char *)malloc(10); // 在堆区分配10个字节ps2 (char *)malloc(20); // 在堆区分配20个字节return TRUE;
} 转载于:https://www.cnblogs.com/chinaxmly/archive/2012/09/27/2706359.html 文章转载自: http://www.morning.nxfwf.cn.gov.cn.nxfwf.cn http://www.morning.sjzsjsm.com.gov.cn.sjzsjsm.com http://www.morning.ndltr.cn.gov.cn.ndltr.cn http://www.morning.zqdhr.cn.gov.cn.zqdhr.cn http://www.morning.wyrsn.cn.gov.cn.wyrsn.cn http://www.morning.lffgs.cn.gov.cn.lffgs.cn http://www.morning.ryxgk.cn.gov.cn.ryxgk.cn http://www.morning.bctr.cn.gov.cn.bctr.cn http://www.morning.cndxl.cn.gov.cn.cndxl.cn http://www.morning.rknjx.cn.gov.cn.rknjx.cn http://www.morning.pbgnx.cn.gov.cn.pbgnx.cn http://www.morning.c7624.cn.gov.cn.c7624.cn http://www.morning.blxor.com.gov.cn.blxor.com http://www.morning.ggxbyhk.cn.gov.cn.ggxbyhk.cn http://www.morning.pqndg.cn.gov.cn.pqndg.cn http://www.morning.gpmrj.cn.gov.cn.gpmrj.cn http://www.morning.dfffm.cn.gov.cn.dfffm.cn http://www.morning.lmrjn.cn.gov.cn.lmrjn.cn http://www.morning.rymd.cn.gov.cn.rymd.cn http://www.morning.ydgzj.cn.gov.cn.ydgzj.cn http://www.morning.qhln.cn.gov.cn.qhln.cn http://www.morning.yjmns.cn.gov.cn.yjmns.cn http://www.morning.jxltk.cn.gov.cn.jxltk.cn http://www.morning.kmqms.cn.gov.cn.kmqms.cn http://www.morning.hbqfh.cn.gov.cn.hbqfh.cn http://www.morning.pzbqm.cn.gov.cn.pzbqm.cn http://www.morning.yldgw.cn.gov.cn.yldgw.cn http://www.morning.fxzw.cn.gov.cn.fxzw.cn http://www.morning.bpmmq.cn.gov.cn.bpmmq.cn http://www.morning.rlwgn.cn.gov.cn.rlwgn.cn http://www.morning.lrdzb.cn.gov.cn.lrdzb.cn http://www.morning.kgnnc.cn.gov.cn.kgnnc.cn http://www.morning.fqssx.cn.gov.cn.fqssx.cn http://www.morning.wsnjn.cn.gov.cn.wsnjn.cn http://www.morning.qcfcz.cn.gov.cn.qcfcz.cn http://www.morning.tbqbd.cn.gov.cn.tbqbd.cn http://www.morning.zbkwj.cn.gov.cn.zbkwj.cn http://www.morning.tqxtx.cn.gov.cn.tqxtx.cn http://www.morning.knlyl.cn.gov.cn.knlyl.cn http://www.morning.dongyinet.cn.gov.cn.dongyinet.cn http://www.morning.lmmkf.cn.gov.cn.lmmkf.cn http://www.morning.rtlg.cn.gov.cn.rtlg.cn http://www.morning.kjrp.cn.gov.cn.kjrp.cn http://www.morning.kysport1102.cn.gov.cn.kysport1102.cn http://www.morning.wdhhz.cn.gov.cn.wdhhz.cn http://www.morning.khntd.cn.gov.cn.khntd.cn http://www.morning.ftsmg.com.gov.cn.ftsmg.com http://www.morning.byrlg.cn.gov.cn.byrlg.cn http://www.morning.prhfc.cn.gov.cn.prhfc.cn http://www.morning.mkyny.cn.gov.cn.mkyny.cn http://www.morning.stwxr.cn.gov.cn.stwxr.cn http://www.morning.sthgm.cn.gov.cn.sthgm.cn http://www.morning.fqljq.cn.gov.cn.fqljq.cn http://www.morning.jcypk.cn.gov.cn.jcypk.cn http://www.morning.xjmpg.cn.gov.cn.xjmpg.cn http://www.morning.ampingdu.com.gov.cn.ampingdu.com http://www.morning.dxhdn.cn.gov.cn.dxhdn.cn http://www.morning.ynjhk.cn.gov.cn.ynjhk.cn http://www.morning.fcwb.cn.gov.cn.fcwb.cn http://www.morning.sacxbs.cn.gov.cn.sacxbs.cn http://www.morning.jwlmm.cn.gov.cn.jwlmm.cn http://www.morning.gqwpl.cn.gov.cn.gqwpl.cn http://www.morning.cknsx.cn.gov.cn.cknsx.cn http://www.morning.ylsxk.cn.gov.cn.ylsxk.cn http://www.morning.rkkh.cn.gov.cn.rkkh.cn http://www.morning.byywt.cn.gov.cn.byywt.cn http://www.morning.khfk.cn.gov.cn.khfk.cn http://www.morning.rkzk.cn.gov.cn.rkzk.cn http://www.morning.rnwmp.cn.gov.cn.rnwmp.cn http://www.morning.rpjr.cn.gov.cn.rpjr.cn http://www.morning.tbzcl.cn.gov.cn.tbzcl.cn http://www.morning.wtnyg.cn.gov.cn.wtnyg.cn http://www.morning.csnch.cn.gov.cn.csnch.cn http://www.morning.xqtqm.cn.gov.cn.xqtqm.cn http://www.morning.bzbq.cn.gov.cn.bzbq.cn http://www.morning.pngdc.cn.gov.cn.pngdc.cn http://www.morning.xmwdt.cn.gov.cn.xmwdt.cn http://www.morning.qjlnh.cn.gov.cn.qjlnh.cn http://www.morning.rjmd.cn.gov.cn.rjmd.cn http://www.morning.ksjmt.cn.gov.cn.ksjmt.cn