728x90
코드블럭에 라인넘버를 설정해주기 위해 관리-스킨편집-html에 들어가 준다.
<!--코드 블럭 라인 번호 추가-->
<script defer src='//cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.8.0/dist/highlightjs-line-numbers.min.js'></script>
<script>
window.onload = function() {
hljs.highlightAll();
hljs.initLineNumbersOnLoad()
}
</script>
HTML탭에서 <head></head>사이에 추가해준다.
/*need for code block*/
pre code {
font-family: "consolas", monospace;
font-size: 1rem;
line-height: 1.3;
}
pre code.hljs {
padding: 10px; margin: 15px 0; max-width: 100%;
overflow-x: auto; overflow-y: hidden; border-radius: 7px; line-height: 130%;
}
.hljs {
white-space: pre;
overflow-x: auto;
}
/* for block of numbers */
.hljs-ln-numbers {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-align: center;
color: #ccc;
border-right: 2px solid #CCC;
vertical-align: top;
padding-right: 10px !important;
/* your custom style here */
}
/* for block of code */
.hljs-ln-code {
padding-left: 15px !important;
}
HTML탭 옆에 있는 CSS탭에 들어가서 추가해준다.
이렇게 나온다면 article_view나 entry-content를 찾아준다.
어떤 블로그를 검색해봐도 다 entry-content를 수정해주라는데 entry-content가 article_view로 바뀐 건지 내 css에서는 아무리 찾아도 entry-content가 없어서 table을 검색해서 유일하게 나오는 article_view를 수정해줬더니 해결됐다.
article_view 뒤에 table이 붙어 있는 곳들을 찾아서 사이에 >를 추가해준다.
라인 넘버가 정상적으로 잘 나온다.
728x90
'0' 카테고리의 다른 글
티스토리 본문 p태그 줄간격 (0) | 2025.02.17 |
---|---|
PC 메모리 RAM 정리 (0) | 2024.04.26 |
티스토리 본문 너비 조절 (0) | 2023.09.10 |
Git (0) | 2022.03.23 |
Clean Code (0) | 2022.03.13 |