콘텐츠로 건너뛰기

EnlighterJS – Syntax Highlighter

  • by

프로그램관련을 많이 찾다보니, 소스코드가 보일 수 있는 부분이 필요하다는 생각, <pre> 태그 <code> 태그가 있으나, 워드프레스를 이용하려고 하니 Syntax Highlighter 플러그인을 찾게되었다. 이것 저것 쓰다보니 EnlighterJS – Syntax Highlighter 가 편리 하다 생각했다.

# 소스코드 나온다 ~~ !!
$ 쉘 명령어도 가능 할듯

EnlighterJS – Syntax Highlighter을 활성화 시킨 후 글쓰기를 하게되면

Enlighter Sourcecode 선택을 한다.
이곳에서 코드를 넣어서 입력
우측 부분을 보게 되면, 소스 코드에 관련한 내용들을 볼 수 있을 것이다.

간단하게 소스코들 아무것이나 넣어보자!

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
(function(){
    // fetch console object
    var _logError = function(msg){
        var prefix = 'Enlighter Error: ';
        if (console.error){
            console.error(prefix + msg);
        }else if (console.log){
            console.log(prefix + msg);
        }
    }

    // MooTools Check
    if (!window.addEvent){
        _logError('MooTools Framework not loaded yet!');
        return;
    }

    // EnlighterJS Check
    if (typeof EnlighterJS == 'undefined'){
        _logError('Javascript Resources not loaded yet!');
        return;
    }

    // EnlighterJS Config Check
    if (typeof EnlighterJS_Config == 'undefined'){
        _logError('Configuration not loaded yet!');
        return;
    }

    // Bootstrap
    window.addEvent('domready', function(){
        EnlighterJS.Util.Init(EnlighterJS_Config.selector.block, EnlighterJS_Config.selector.inline, EnlighterJS_Config);
    });
})();

앞으로 많은 부분에 이용 할 수 있을 것 같다.
리눅스, 스크립트, 프로그램 등 필요할 때마다 필요한것들을 정리할 것이다.

답글 남기기