syntax highlighter in DOKUWIKI
/conf/userstyle.css
파일을 생성하고 스타일을 입력한다.
- snippet.javascript
body p { font-size: medium; } body .syntaxhighlighter .line { white-space: pre-wrap !important; /* make code wrap */ }
js 파일에 줄바꿈에 대한 넘버링 수정 코드를 입력한다. page.js
파일에 추가하였습니다.
- snippet.java
/* Syntax Highlighter Wrap */ function lineWrap(){ var wrap = function () { var elems = document.getElementsByClassName('syntaxhighlighter'); for (var j = 0; j < elems.length; ++j) { var sh = elems[j]; var gLines = sh.getElementsByClassName('gutter')[0].getElementsByClassName('line'); var cLines = sh.getElementsByClassName('code')[0].getElementsByClassName('line'); var stand = 15; for (var i = 0; i < gLines.length; ++i) { var h = jQuery(cLines[i]).height(); if (h != stand) { console.log(i); gLines[i].setAttribute('style', 'height: ' + h + 'px !important;'); } } } }; var whenReady = function () { if (jQuery('.syntaxhighlighter').length === 0) { setTimeout(whenReady, 800); } else { wrap(); } }; whenReady(); }; lineWrap(); jQuery(window).resize(function(){lineWrap()});