Coder Social home page Coder Social logo

ajax-syntax-highlighter's Introduction

=Ajax Syntax Highlighter=

_Ajax Syntax Highlighter_ is a small Javascript utility designed to highlight code embed in a web page in a standard compliant way.
It automatically looks for source code in the page, send it to a server-side highlighter and display the highlighted code. It also has a "view as plain text" feature.

_Ajax Syntax Highlighter_ is built with [http://developer.yahoo.com/yui/ Yahoo! UI] and uses [http://www.json.org/ JSON] for serialization. It is wrote by [http://lapin-blanc.net Kévin Dunglas].
It currently includes [http://qbnz.com/highlighter/ GeSHi] as server-side (PHP required) highlighter but it can be easily used with others such as [http://pygments.org/ Pygments].

*[http://lapin-blanc.net/wp-content/plugins/ajax-syntax-highlighter/test.html See a demo.]*

==Install==

Unzip the archive or get _Ajax Syntax Highlighter_ via Subversion. Put the resulting directory into your Apache document root with PHP enabled (for GeSHi).

Try to load `http://<your-host>/<your-directory>/ajax-syntax-highlighter/test.html` to check if your installation is correct.

In your HTML file add the following lines in the `HEAD` section to active _Ajax Syntax Highlighter_:
{{{
<link rel="stylesheet" type="text/css" href="http://<your-host>/<your-directory>/ajax-syntax-highlighter/ajax-syntax-highlighter.css" />

<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.5.2/build/yahoo-dom-event/yahoo-dom-event.js&amp;2.5.2/build/connection/connection-min.js&amp;2.5.2/build/json/json-min.js&amp;2.5.2/build/selector/selector-beta-min.js"></script>
<script type="text/javascript" src="http://<your-host>/<your-directory>/ajax-syntax-highlighter/ajax-syntax-highlighter.js"></script>
}}}

Is is also recommended to use the Yahoo! UI base, fonts and reset CSS files. Put before the previous lines:
{{{
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/reset-fonts/reset-fonts.css" /> 
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/base/base-min.css" />
}}}

Now add your snippets to your page like this:
{{{
<pre><code class="language-php">&lt;?php
echo 'Hello, World';
?&gt;</code></pre>
}}}

You must use the `code` tag with a `class` attribute following the HTML5 `language-<language-name>` convention. You can add a `pre` tag if needed.

That's all folk !

ajax-syntax-highlighter's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.