SQL syntax highlighter for PrismJS 2


After the Python highlighter, here is an SQL syntax highligher for PrismJS. Covering over 380 important keywords from the most famous SQL database implementations, such as MySQL, Microsoft SQL Server etc.

SQL Highlighting Sample


//one line comment
/* 
 * multiline 
 * comments
 */
SELECT Book.title 
 FROM Book
 JOIN Book_author ON Book.isbn = Book_author.isbn
 GROUP BY Book.title
HAVING Book.price > 10.4 AND Book_author.name = "Frank"
ORDER BY No_of_Authors ; -- another comment style

 
Until my GitHub fork merged with the original PrismJS project, you can download this add-on and use it with the existing PrismJS script, by putting it after the the prism.min.js script definition and by using the value language-sql at class property of the code element you like to highlight.

Usage

. . .
<script src="prism.min.js"></script>
<script src="prism-sql.min.js"></script>
. . .
<pre><code class="language-sql">
. . .

 
Download Prism SQL Higlighter


2 thoughts on “SQL syntax highlighter for PrismJS

  • anyapeter

    Greetings from Colorado! I’m bored at work so I decided to browse your website on my iphone during lunch break. I love the knowledge you present here and can’t wait to take
    a look when I get home. I’m shocked at how fast your blog loaded on my phone .. I’m not even using WIFI,
    just 3G .. Anyways, fantastic blog!

  • astuce amour sucré

    Hi my loved one! I want to say that this article is awesome, great written and
    come with approximately all important infos.
    I would like to peer extra posts like this .

Comments are closed.