기술 블로그를 쓰다보면 code를 전달하기 위해 code block이 필요할 때가 있다. 이럴 경우 html tag를 조합해서 넣기도 해야하고 혹은 code script와 같은 web site의 힘을 빌리기도 한다.
google의 code block을 위한 js library를 사용한다면 블로그에 code넣는 것이 한결 수월해진다.
그리고 간단한 css 옵션 추가를 통해 더 이쁘게 코드를 작성, 전달 할 수 있다.
pre.prettyprint { padding: 14px; //padding 설정 font-size: 1.1rem; line-height: 1.45; background-color: #f6f8fa; //code block background color border-radius: 3px; //code block radius border border: 1px solid #fff; margin: 2px; //margin 설정 }
class Person{private String name;private Int age;}
만약 특정 language의 color로 색을 입히고 싶다면 아래와 같이 작성하면 된다.
(작성하지 않는 경우 auto detect)
html language에 맞는 colorjava language에 맞는 colorc language에 맞는 color* language에 맞는 color
지원하는 language는 아래와 같다.
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", "xhtml", "xml", "xsl"
class Person{
private String name;
private Int age;
}
감사합니다.
※ 추가적으로 code pretty 안에 <> 와 같은 특수문자를 넣고 싶다면 xmp tag를 추가한다.
'일상 > 유용한 사이트' 카테고리의 다른 글
그래픽 레코딩 - 시각화와 회의의 조합 (0) 2020.11.27 [macOS] 디렉토리를 ascii tree로 보여주는 명령어 설치 및 실행 (0) 2020.07.19 Shutterstock - 2020 컬러 트렌드 (0) 2019.12.04 맥북, 인터넷 웹에서 hwp파일 무료로 업로드, 수정, 저장하기. (0) 2019.05.02 구글 search engine에 내 블로그 상위에 검색되게 하기 (0) 2018.06.19 유용한 무료 사진 사이트 Unsplash & Unsplash api (0) 2017.07.16