海芋小站
上看到的在 Blogger 中插入美觀的程式碼 ~ 使用syntaxhighlighter 2.0 實戰
決定來測試一下
因為是測試所以就全部
把支援的程式碼通通上傳了
Brush name | Brush aliases | File name |
---|---|---|
Bash/shell | bash, shell | shBrushBash.js |
C# | c-sharp, csharp | shBrushCSharp.js |
C++ | cpp, c | shBrushCpp.js |
CSS | css | shBrushCss.js |
Delphi | delphi, pas, pascal | shBrushDelphi.js |
Diff | diff, patch | shBrushDiff.js |
Groovy | groovy | shBrushGroovy.js |
JavaScript | js, jscript, javascript | shBrushJScript.js |
Java | java | shBrushJava.js |
PHP | php | shBrushPhp.js |
Plain Text | plain, text | shBrushPlain.js |
Python | py, python | shBrushPython.js |
Ruby | rails, ror, ruby | shBrushRuby.js |
SQL | sql | shBrushSql.js |
Visual Basic | vb, vbnet | shBrushVb.js |
XML | xml, xhtml, xslt, html, xhtml | shBrushXml.js |
首先可能是版型的關係
我的那兩個css是把他貼在]]></b:skin>才成功的
複製出來的css內容
.syntaxhighlighter,
.syntaxhighlighter div,
.syntaxhighlighter code,
.syntaxhighlighter span,
.syntaxhighlighter .bold,
.syntaxhighlighter .italic,
.syntaxhighlighter .line,
.syntaxhighlighter .line .number,
.syntaxhighlighter .line .content,
.syntaxhighlighter .line .content .block,
.syntaxhighlighter .line .content .spaces,
.syntaxhighlighter .bar,
.syntaxhighlighter .ruler,
.syntaxhighlighter .toolbar,
.syntaxhighlighter .toolbar a,
.syntaxhighlighter .toolbar a:hover
{
margin: 0;
padding: 0;
border: 0;
outline: 0;
background: none;
text-align: left;
float: none;
vertical-align: baseline;
position: static;
left: auto;
top: auto;
right: auto;
bottom: auto;
height: auto;
width: auto;
line-height: normal;
font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
font-weight: normal;
font-style: normal;
font-size: 100%;
}
.syntaxhighlighter
{
width: 100%;
margin: 1em 0 1em 0;
padding: 1px; /* adds a little border on top and bottom */
position: relative;
}
.syntaxhighlighter .bold {
font-weight: bold;
}
.syntaxhighlighter .italic {
font-style: italic;
}
.syntaxhighlighter .line .number
{
float: left;
width: 3em;
padding-right: .3em;
text-align: right;
display: block;
}
/* Disable numbers when no gutter option is set */
.syntaxhighlighter.nogutter .line .number
{
display: none;
}
.syntaxhighlighter .line .content
{
margin-left: 3.3em;
padding-left: .5em;
display: block;
}
.syntaxhighlighter .line .content .block
{
display: block;
padding-left: 1.5em;
text-indent: -1.5em;
}
.syntaxhighlighter .line .content .spaces
{
display: none;
}
/* Disable border and margin on the lines when no gutter option is set */
.syntaxhighlighter.nogutter .line .content
{
margin-left: 0;
border-left: none;
}
.syntaxhighlighter .bar
{
}
.syntaxhighlighter.collapsed .bar
{
}
.syntaxhighlighter.nogutter .ruler
{
margin-left: 0;
padding-left: 0;
}
.syntaxhighlighter .ruler
{
padding: 0 0 .5em .5em;
margin-left: 3.3em;
overflow: hidden;
}
/* Adjust some properties when collapsed */
.syntaxhighlighter.collapsed .lines,
.syntaxhighlighter.collapsed .ruler
{
display: none;
}
/* Styles for the toolbar */
.syntaxhighlighter .toolbar
{
position: absolute;
right: 0px;
top: 0px;
font-size: 1px;
padding: 8px 8px 8px 0; /* in px because images don't scale with ems */
}
.syntaxhighlighter.collapsed .toolbar
{
font-size: 80%;
padding: .2em 0 .5em .5em;
position: static;
}
.syntaxhighlighter .toolbar a.item,
.syntaxhighlighter .toolbar .item
{
display: block;
float: left;
margin-left: 8px;
background-repeat: no-repeat;
overflow: hidden;
text-indent: -5000px;
}
.syntaxhighlighter.collapsed .toolbar .item
{
display: none;
}
.syntaxhighlighter.collapsed .toolbar .item.expandSource
{
background-image: url(我的網址magnifier.png);
display: inline;
text-indent: 0;
width: auto;
float: none;
height: 16px;
padding-left: 20px;
}
.syntaxhighlighter .toolbar .item.viewSource
{
background-image: url(我的網址page_white_code.png);
}
.syntaxhighlighter .toolbar .item.printSource
{
background-image: url(我的網址printer.png);
}
.syntaxhighlighter .toolbar .item.copyToClipboard
{
text-indent: 0;
background: none;
overflow: visible;
}
.syntaxhighlighter .toolbar .item.about
{
background-image: url(我的網址help.png);
}
/**
* Print view.
* Colors are based on the default theme without background.
*/
.syntaxhighlighter.printing,
.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,
.syntaxhighlighter.printing .line .content .block
{
background: none;
}
/* Gutter line numbers */
.syntaxhighlighter.printing .line .number
{
color: #bbb;
}
/* Add border to the lines */
.syntaxhighlighter.printing .line .content
{
color: #000;
}
/* Toolbar when visible */
.syntaxhighlighter.printing .toolbar,
.syntaxhighlighter.printing .ruler
{
display: none;
}
.syntaxhighlighter.printing a
{
text-decoration: none;
}
.syntaxhighlighter.printing .plain,
.syntaxhighlighter.printing .plain a
{
color: #000;
}
.syntaxhighlighter.printing .comments,
.syntaxhighlighter.printing .comments a
{
color: #008200;
}
.syntaxhighlighter.printing .string,
.syntaxhighlighter.printing .string a
{
color: blue;
}
.syntaxhighlighter.printing .keyword
{
color: #069;
font-weight: bold;
}
.syntaxhighlighter.printing .preprocessor
{
color: gray;
}
.syntaxhighlighter.printing .variable
{
color: #a70;
}
.syntaxhighlighter.printing .value
{
color: #090;
}
.syntaxhighlighter.printing .functions
{
color: #ff1493;
}
.syntaxhighlighter.printing .constants
{
color: #0066CC;
}
.syntaxhighlighter.printing .script
{
font-weight: bold;
}
.syntaxhighlighter.printing .color1,
.syntaxhighlighter.printing .color1 a
{
color: #808080;
}
.syntaxhighlighter.printing .color2,
.syntaxhighlighter.printing .color2 a
{
color: #ff1493;
}
.syntaxhighlighter.printing .color3,
.syntaxhighlighter.printing .color3 a
{
color: red;
}
.syntaxhighlighter
{
background-color: #E7E5DC;
}
/* Highlighed line number */
.syntaxhighlighter .line.highlighted .number
{
background-color: #6CE26C;
color: black;
}
/* Highlighed line */
.syntaxhighlighter .line.highlighted.alt1 .content,
.syntaxhighlighter .line.highlighted.alt2 .content
{
background-color: #6CE26C;
}
/* Gutter line numbers */
.syntaxhighlighter .line .number
{
color: #5C5C5C;
}
/* Add border to the lines */
.syntaxhighlighter .line .content
{
border-left: 3px solid #6CE26C;
color: #000;
}
.syntaxhighlighter.printing .line .content
{
border: 0;
}
/* First line */
.syntaxhighlighter .line.alt1 .content
{
background-color: #fff;
}
/* Second line */
.syntaxhighlighter .line.alt2 .content
{
background-color: #F8F8F8;
}
.syntaxhighlighter .line .content .block
{
background: url(wrapping.png) 0 1.1em no-repeat;
}
.syntaxhighlighter .ruler
{
color: silver;
background-color: #F8F8F8;
border-left: 3px solid #6CE26C;
}
.syntaxhighlighter.nogutter .ruler
{
border: 0;
}
.syntaxhighlighter .toolbar
{
background-color: #F8F8F8;
border: #E7E5DC solid 1px;
}
.syntaxhighlighter .toolbar a
{
color: #a0a0a0;
}
.syntaxhighlighter .toolbar a:hover
{
color: red;
}
/************************************
* Actual syntax highlighter colors.
************************************/
.syntaxhighlighter .plain,
.syntaxhighlighter .plain a
{
color: #000;
}
.syntaxhighlighter .comments,
.syntaxhighlighter .comments a
{
color: #008200;
}
.syntaxhighlighter .string,
.syntaxhighlighter .string a
{
color: blue;
}
.syntaxhighlighter .keyword
{
color: #069;
font-weight: bold;
}
.syntaxhighlighter .preprocessor
{
color: gray;
}
.syntaxhighlighter .variable
{
color: #a70;
}
.syntaxhighlighter .value
{
color: #090;
}
.syntaxhighlighter .functions
{
color: #ff1493;
}
.syntaxhighlighter .constants
{
color: #0066CC;
}
.syntaxhighlighter .script
{
background-color: yellow !important;
}
.syntaxhighlighter .color1,
.syntaxhighlighter .color1 a
{
color: #808080;
}
.syntaxhighlighter .color2,
.syntaxhighlighter .color2 a
{
color: #ff1493;
}
.syntaxhighlighter .color3,
.syntaxhighlighter .color3 a
{
color: red;
}
所有拿來用的功能
沒有留言:
張貼留言