본문 바로가기
블로그 운영/블로그 운영팁

[티스토리]콘솔 메시지 initHighlightingOnLoad() 해결 방법

by 빽짱구 2024. 5. 8.

티스토리 콘솔 메시지가 아래와 같이 표시될 때가 있다.

 

Deprecated as of 10.6.0. initHighlightingOnLoad() is deprecated. Use highlightAll() instead.

 

원인

highlight.min.js 사용시 <script>initHighlightingOnLoad()</script> 이렇게 함수를 호출하는데 해당함수는 구식함수이기 때문이다.

 

공식문서에는 아래처럼 사용하라고 안내한다.

<link rel="stylesheet" href="/path/to/styles/default.css">
<script src="/path/to/highlight.min.js"></script>

<script>hljs.highlightAll();</script>

 

<script>hljs.highlightAll();</script>

 

참고

https://highlightjs.org/#news-142

 

highlight.js

Usage highlight.js can be used in different ways such using CDNs, hosting the bundle yourself, as a Vue plug-in, as ES6 modules, with Node.js, and web workers. See our README on GitHub for more details. As a Module Highlight.js can be used with Node on the

highlightjs.org

반응형

문제점

티스토리에서 highlight.min.js 기능은 플러그인으로 제공을 하며, 사용자가 소스를 변경할 수가 없기에 티스토리에서 개선하지 않는 이상 저런 메시지를 안고 가야만 한다.

 

 

 

크리티컬한 이슈는 아니지만, 개발자 입장에서는 신경 쓰이는 메시지라 개선해 주길 희망해 본다.