2015/05/24

Google Blogger PrettyPrint 설정

SyntaxyHighlighter 이거 겨우 설정을 해뒀더니 모바일에서는 적용도 되지 않을 뿐더러 완전 모양빠지게 나와서 다시 찾은 대안이 google PrettyPrint. 근데 템플릿에 적용 해뒀더니 페이지별로 조회는 잘 되는데 페이지 전체 목록에서 볼 때는 RowBackgroundColor가 구림. 그래서.. 필요한 페이지는 직접 아래 소스를 직접 입력한다. 그럼 모바일에서도 적용 되고 템플릿 변경해도 따로 작업하지 않아도 된다.

<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&skin=sons-of-obsidian&lang=html" defer="defer"></script>
skin style(소문자로 적어야 제대로 적용된다)
language list

사용법
before

<pre class="prettyprint lang-java linenums">
package test;

public class Test {
public static main(String...args) {
System.out.println("Hello world");
}
}
</pre>
after

package test;

public class Test {
public static main(String...args) {
System.out.println("Hello world");
}
}


before

<?prettify lang=java linenums=40?> <!-- linenumber를 40부터 시작 -->
<pre class="prettyprint">
package test;

public class Test {
public static main(String...args) {
System.out.println("Hello world");
}
}
</pre>
after

package test;

public class Test {
public static main(String...args) {
System.out.println("Hello world");
}
}
더 자세한 설명은 아래 링크에서 확인
https://code.google.com/p/google-code-prettify/
Github으로 이사 갔음.
https://github.com/google/code-prettify

댓글 없음:

댓글 쓰기