More Perfect Pre Tags

Download pre-code-1.0.zip (4kb minified, 6.6kb source)

Get jQuery (required)

Get Prettify (only used for syntax highlighting)

Here are some examples with the different options:

// really long block with just <pre><code>
	wp_register_style(self::$plugin_stylesheet_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-styles.css' );
	wp_enqueue_style(self::$plugin_stylesheet_id); 
	wp_register_script(self::$plugin_script_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-scripts.js' );
	wp_enqueue_script(self::$plugin_script_id);
// uses <pre data-max-width="800">
// max-width is also supported in case you care about brevity more than html5 validation
	wp_register_style(self::$plugin_stylesheet_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-styles.css' );
	wp_enqueue_style(self::$plugin_stylesheet_id); 
	wp_register_script(self::$plugin_script_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-scripts.js' );
	wp_enqueue_script(self::$plugin_script_id);
// with class noprettyprint
	wp_register_style(self::$plugin_stylesheet_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-styles.css' );
	wp_enqueue_style(self::$plugin_stylesheet_id);
	wp_register_script(self::$plugin_script_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-scripts.js' );
	wp_enqueue_script(self::$plugin_script_id);
// with class nolinenums
	wp_register_style(self::$plugin_stylesheet_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-styles.css' );
	wp_enqueue_style(self::$plugin_stylesheet_id); 
	wp_register_script(self::$plugin_script_id, WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/admin-scripts.js' );
	wp_enqueue_script(self::$plugin_script_id);
// just <pre> and no <code>
 ____  ____   ____     ___  ____   ___    __ __   ____  ______  ____  ___   ____    _____        __   ___   ___ ___ 
l    j|    \ |    \   /  _]|    \ |   \  |  T  | /    T|      Tl    j/   \ |    \  / ___/       /  ] /   \ |   T   T
 |  T |  _  Y|  _  Y /  [_ |  D  )|    \ |  |  |Y  o  ||      | |  TY     Y|  _  Y(   \_       /  / Y     Y| _   _ |
 |  | |  |  ||  |  |Y    _]|    / |  D  Y|  |  ||     |l_j  l_j |  ||  O  ||  |  | \__  T     /  /  |  O  ||  \_/  |
 |  | |  |  ||  |  ||   [_ |    \ |     |l  :  !|  _  |  |  |   |  ||     ||  |  | /  \ | __ /   \_ |     ||   |   |
 j  l |  |  ||  |  ||     T|  .  Y|     | \   / |  |  |  |  |   j  ll     !|  |  | \    ||  T\     |l     !|   |   |
|____jl__j__jl__j__jl_____jl__j\_jl_____j  \_/  l__j__j  l__j  |____j\___/ l__j__j  \___jl__j \____j \___/ l___j___j

Credits:

Written by Ben Irvin - innerdvations.com

Idea and original core of code from "How to Create Perfect Pre Tags"