Personal Interest/ETC

syntaxhighlighter

neodelicious 2017. 7. 9. 01:35

code 를 가져다 붙여야 할 것 같은데, 환경 좀 구축해 보자.


http://alexgorbatchev.com/SyntaxHighlighter/ 우측에 download link 가 있다. SyntaxHighlighter v4 라고 나오는 것으로 보아 참고 자료의 2.x 혹은 3.x 을 넘어 현재 4.x 인가 보다.


 

4.x 에 도전해보기로 했는데 build 에 실패해서 포기했다.

https://github.com/syntaxhighlighter/syntaxhighlighter/wiki/Building 를 따라서 아래처럼 했다.


$ git clone https://github.com/syntaxhighlighter/syntaxhighlighter.git

$ cd syntaxhighlighter

현재 commit 상태는 아래와 같이 4.0.1 version 이후 몇 개 commit 이 더 있는 상태다.

37724fd Merge pull request #404 from claushellsing/patch-1

bac944c Update README.md

b35cee8 Merge pull request #384 from appetere/Issue378

fb548cf Clone repos using HTTPS instead of SSH

7caa963 4.0.1


npm install

npm 이라는 build tool 이 따로 있는 것 같다. 설치되어 있지 않다고 나와서 Ubuntu guide 대로 설치했다.

$ sudo apt-get install npm

그리고 나서 npm install 를 하니 뭔가 엄청 download 하는 것 처럼 보인다.

npm install 이 끝나고 나니 node_modules 라는 directory 가 생겼다.


$ ./node_modules/gulp/bin/gulp.js setup-project

/usr/bin/env: node: No such file or directory


$ ./node_modules/gulp/bin/gulp.js build --brushes=all --theme=default


그냥 참고 자료처럼 이미 build 되어 있는 3.0.83 을 이용해보자. https://github.com/syntaxhighlighter/syntaxhighlighter/releases/tag/3.0.83 의 맨 아래에 Source code (zip) 가 있다.


자세한 것은 그냥 참고 자료를 따라했다.




http://withcoding.com/8 를 우선 따라했고,

http://alexgorbatchev.com/SyntaxHighlighter/manual/themes/fadetogrey.html 를 따라 theme 을 default 대신 흑색 배경의 다른 것으로 shThemeFadeToGrey.css 으로 바꿨다.


http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/highlight.html 을 따라 특정 line 에 highlight 를 줄 수도 있었다.


<pre class="brush:c; highlight:3">int main (int argc, char *argv[])

{

return 0;

}

</pre>


html mode 에서 위에 5줄을 붙였더니 아래와 같이 보였다.


int main (int argc, char *argv[])
{
	return 0;
}