자유게시판

그누보드 5.4 이상 흑 이용 Syntax Highlight 적용하기

페이지 정보

profile_image
작성자천사 조회 12,840회 작성일 2021-09-20 22:52:07 댓글 0

본문

출처: https://gnu.kilho.net/tiptech/1210

 

[code]

<?
  function kh_tail_sub()
  {
    global $wr_id;

    // 게시판에서 view.php 호출할때 적용하도록
    if($_SERVER['SCRIPT_NAME'] != '/bbs/board.php'  || !$wr_id) return;
  ?>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/a11y-dark.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>

<script>
function sh(id) {
  var $id = $("#" + id);
  if ($id.length > 0) {
    var html = $id.html();
    html = html.split("[code]").join("<pre><code>");
    html = html.split("[/code]").join("</pre></code>");
    $id.html(html);
    $id.find("pre>code").each(function() {
      var text = $.trim($(this).text());
      $(this).text(text);
    });
  }
}

$(function() { 
  sh("bo_v_con"); 

  hljs.initHighlighting();
});
</script>
  <?
  }
  add_event('tail_sub', 'kh_tail_sub', G5_HOOK_DEFAULT_PRIORITY);
?>

[/code]

댓글목록

등록된 댓글이 없습니다.

Copyright © Claw’s Lab · blog.batifa.com