Changeset 647604
- Timestamp:
- 01/03/2013 10:01:20 PM (13 years ago)
- Location:
- goodbye-syntax-highlighter/trunk
- Files:
-
- 2 edited
-
goodbye-syntax-highlighter.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
goodbye-syntax-highlighter/trunk/goodbye-syntax-highlighter.php
r585170 r647604 2 2 /* 3 3 Plugin Name: goodbye-syntax-highlighter 4 Plugin URI: http ://www.visoftinc.com4 Plugin URI: https://github.com/visoft/goodbye-syntax-highlighter 5 5 Description: Say goodbye to syntaxhighlighter and hello to highlight.js 6 Version: 0.1. 06 Version: 0.1.1 7 7 Author: Damien White (Visoft, Inc.) 8 8 Author URI: http://www.visoftinc.com … … 42 42 // covert csharp into cs 43 43 if ($language == 'csharp') $language = 'cs'; 44 return '<pre><code class=" '. $language . '">' . $code . '</code></pre>';44 return '<pre><code class="language-'. $language . '">' . $code . '</code></pre>'; 45 45 } -
goodbye-syntax-highlighter/trunk/readme.txt
r585170 r647604 4 4 Tags: highlight.js, syntax, code, pre, highlight, syntaxhighlighter 5 5 Requires at least: 3.1 6 Tested up to: 3. 4.17 Stable tag: 0.1. 06 Tested up to: 3.5 7 Stable tag: 0.1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 For years I've used [Alex Gorbatchev's SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/). It has served me well over the years. When I moved to WordPress I tried various plugins based on the library, such [SyntaxHighlighter Evolved](http://wordpress.org/extend/plugins/syntaxhighlighter/). 15 15 16 I've decided to start blogging using [Markdown](http://daringfireball.net/projects/markdown/). Making this move I needed to find a way to highlight various bits of source code in an easy way. There are many nice libraries that make this a snap, such as [google-code-prettify](http://code.google.com/p/google-code-prettify/) or [highlight.js](http://softwaremaniacs.org/soft/highlight/en/). In the end I decided to go with highlight.js, for the simple reason that it is automatic, working flawlessly with Markdown's code syntax output.16 I've decided to start blogging using [Markdown](http://daringfireball.net/projects/markdown/). Making this move I needed to find a way to highlight various bits of source code in an easy way. There are many nice libraries that make this a snap, such as [google-code-prettify](http://code.google.com/p/google-code-prettify/) or [highlight.js](http://softwaremaniacs.org/soft/highlight/en/). In the end I decided to go with highlight.js, for the simple reason that it is automatic, working flawlessly with Markdown's code syntax output. 17 17 18 18 Great, but my existing source code examples use SyntaxHighlighter's style for code blocks (using `<pre class="brush: ruby;" />`, for example). I could have converted things in a few ways: … … 23 23 * Write a WP plugin and reformat things easily **Ding Ding Ding** 24 24 25 So there you have it. This WordPress plugin will go through and process your SyntaxHighlighter style blocks into ones that highlight.js works with out-of-the-box. Nothing is changed in the DB, so if you decide to go back to SyntaxHighlighter, you can without any issues.25 So there you have it. This WordPress plugin will go through and process your SyntaxHighlighter style blocks into ones that highlight.js works with out-of-the-box. It will also add the language that you have specified with the `brush` class and add it as a class on the `<code />` element ([following the HTML5 recommendation](http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html#the-code-element)). Nothing is changed in the DB, so if you decide to go back to SyntaxHighlighter, you can without any issues. 26 26 27 27 == Installation == … … 36 36 = 0.1.0 = 37 37 * Initial release 38 = 0.1.1 = 39 * Modified output to use the HTML5 recommended syntax highlighting class names, e.g. `language-ruby`. For more information, see [the HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html#the-code-element)
Note: See TracChangeset
for help on using the changeset viewer.