et cetera

[Style] 티스토리 코드블럭 스타일 입히기

melius102 2019. 12. 19. 18:42

highlight.js

https://highlightjs.org/

https://aossuper8.tistory.com/121

 

styles폴더에서 원하는 css 파일(your_style.css)을 선택

스킨 편집 > html 편집 > 파일업로드에서 highlight.pack.js 파일과 your_style.css 파일을 업로드

 

HTML head 태그에 추가

<link rel="stylesheet" href="./images/your_style.css">
<script src="./images/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

 

let num = 1;
console.log(num);

function $initHighlight(block, cls) {
  try {
    if (cls.search(/\bno\-highlight\b/) != -1)
      return process(block, true, 0x0F) +
             ` class="${cls}"`;
  } catch (e) {
    /* handle exception */
  }
  for (var i = 0 / 2; i < classes.length; i++) {
    if (checkCondition(classes[i]) === undefined)
      console.log('undefined');
  }

  return (
    <div>
      <web-component>{block}</web-component>
    </div>
  )
}

export  $initHighlight;