남들은 다 잘 쓰는 Syntax Highlighter가 왜 적용이 안되는지 도대체 모르겠다.
아마 전에도 시도했었는데, 결국은 못해서 그냥 티스토리를 접어 버렸다..
그런데 갑자기 방문자 수도 늘고 글로 남겨놓고 싶은게 있어서, 이번에도 시도해봤는데 또 못했다.
그래서 찾은 대안은 Gist (https://gist.github.com)다.
아마 이 글을 보러온 대부분은 개발을 하는 사람들이어서 Github를 다들 알 것이다.
Gist는 Github에서 관리하는 Code snippet(공식적인 설명은 아니다.), 작은 단위의 코드 블럭들을 올려놓고 공유하는 저장소이다. 자세한건 About gists를 참고.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String args[]){ | |
System.out.println("Hello world!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
printf("Hello World!\n"); | |
return 0; | |
} |
위는 간단한 예시다.
다른 블로그는 사용해보질 않아서 티스토리를 기준으로 설명한다. 아마 비슷할 것이다.
위에 걸어놓은 url에서 코드를 작성하면, 이와 같은 창을 볼 수 있다.
노란색으로 하이라이팅 된 부분을 복사하고, 티스토리 글쓰기 창에서 오른쪽 위 HTML을 클릭해준다.
현재 작성 중인 이 글을 예시로 한 것이다. 글 중간에 붙여넣고 발행하면 위의 예시들과 깔끔하게 출력된다.
다른 분들이 많이 사용(?)하는 Syntax Highlighter는 언어별로 전부 js 파일과 css를 넣어줘야하는 반면에, 이건 gist 쪽에서 알아서 해주니 편하다.
'기타' 카테고리의 다른 글
윈도우에서 클립보드 히스토리 (Ditto Clipboard) (0) | 2018.05.30 |
---|---|
golang 입문 참고 자료 링크 (한국어) (0) | 2018.05.01 |
리눅스에서 자주 쓰는 명령어를 스크립트로 따놓기 (bash shell) (0) | 2018.04.06 |
Windows bash (Linux subsystem) 한글(글자) 깨짐 (0) | 2017.02.24 |
윈도우 10에서 Linux subsystem 설치 후에도 bash가 실행이 안될 때 (0) | 2016.12.19 |