티스토리 (tistory) 에서 SyntaxHighlighter 이용해서 코드 (code) 포스팅하기
카테고리 없음 2011. 6. 11. 17:511. SyntaxHighlighter 받아오기
압축풀고 나온 여러 폴더중에서 styles, scripts 폴더만 사용할것임.
티스토리에 로긴후에, 스킨->파일 업로드 로 가서
styles, scripts 폴더에 있는 모든 파일을 올린다.
3. TISTORY 스킨 파일 편집.
스킨-> HTML/CSS편집에 가서 skin.html 부분 중에 </body> 앞부분에 아래 내용을 추가한다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | < link rel = "stylesheet" media = "screen" type = "text/css" href = "./style.css" > < script type = "text/javascript" src = "./images/shCore.js" ></ script > < link href = "./images/shThemeEmacs.css" rel = "stylesheet" type = "text/css" > < script type = "text/javascript" src = "./images/shBrushAS3.js" ></ script > < script type = "text/javascript" src = "./images/shBrushBash.js" ></ script > < script type = "text/javascript" src = "./images/shBrushCpp.js" ></ script > < script type = "text/javascript" src = "./images/shBrushCSharp.js" ></ script > < script type = "text/javascript" src = "./images/shBrushCss.js" ></ script > < script type = "text/javascript" src = "./images/shBrushDelphi.js" ></ script > < script type = "text/javascript" src = "./images/shBrushDiff.js" ></ script > < script type = "text/javascript" src = "./images/shBrushGroovy.js" ></ script > < script type = "text/javascript" src = "./images/shBrushJava.js" ></ script > < script type = "text/javascript" src = "./images/shBrushJavaFX.js" ></ script > < script type = "text/javascript" src = "./images/shBrushJScript.js" ></ script > < script type = "text/javascript" src = "./images/shBrushPerl.js" ></ script > < script type = "text/javascript" src = "./images/shBrushPhp.js" ></ script > < script type = "text/javascript" src = "./images/shBrushPlain.js" ></ script > < script type = "text/javascript" src = "./images/shBrushPowerShell.js" ></ script > < script type = "text/javascript" src = "./images/shBrushPython.js" ></ script > < script type = "text/javascript" src = "./images/shBrushRuby.js" ></ script > < script type = "text/javascript" src = "./images/shBrushScala.js" ></ script > < script type = "text/javascript" src = "./images/shBrushSql.js" ></ script > < script type = "text/javascript" src = "./images/shBrushVb.js" ></ script > < script type = "text/javascript" src = "./images/shBrushXml.js" ></ script > < script type = "text/javascript" src = "./images/shLegacy.js" ></ script > < script type = "text/javascript" src = "./images/shCore.js" ></ script > < link href = "./images/shThemeEmacs.css" rel = "stylesheet" type = "text/css" > < script type = "text/javascript" > SyntaxHighlighter.config.stripBrs = true; SyntaxHighlighter.all(); </ script > |
4. TISTORY에서 글쓰기.
글쓰기 모드를 html 모드로 바꾸고 다음과 같이 입력한다.
1 2 3 4 5 6 7 | < pre class = "brush:c++; toolbar: false" > #include < stdio.h > int main( int argc, const char* argv[] ) { printf( "\nHello World\n\n" ); } </ pre > |
1 2 3 4 5 | #include <stdio.h> int main( int argc, const char * argv[] ) { printf ( "\nHello World\n\n" ); } |
<주의 사항>
SyntaxHighlighter 3.0.83의 버그가 있다.
꺽쇠인 "<"나 ">"를 포스팅할 소스코드에 포함되어 있다면 포스팅이 깨진다.
코드를 올릴때 "<"를 "<"로, ">"를 ">"로 변환해서 올려야 제대로 된다.