Giter Club home page Giter Club logo

syntaxhighlight's Introduction

SyntaxHighlight

SyntaxHighlight est un plugin pour TinyMCE 4.x qui utilise le script de http://alexgorbatchev.com/SyntaxHighlighter/ pour la coloration. Il n'y a pas de coloration en direct dans le plugin ou l'éditeur, le plugin se charge de renseigner les attributs nécessaires.

Installation

  • Plugin externe : Mettez le dossier SyntaxHighlight sur votre serveur web
tinymce.init({
	[...]
	external_plugins: {
		"SyntaxHighlight": "PathToSyntaxHighlight/plugin.min.js"
	},
	toolbar: "[...] SyntaxHighlight",
	[...]
});

Remplacez 'PathToSyntaxHighlight' par l'adresse du dossier SyntaxHighlight

  • Plugin interne : Ajoutez le dossier SyntaxHighlight dans le dossier des plugins de TinyMCE ('tinymce/plugins/')
tinymce.init({
	[...]
	plugins: "[...] SyntaxHighlight",
	toolbar: "[...] SyntaxHighlight",
	[...]
});

Pour afficher le code coloré, ajoutez dans le head de votre page :

<script src="PathToSyntaxHighlight/SyntaxHighlighter/scripts/shCore.js" type="text/javascript"></script>
<script src="PathToSyntaxHighlight/SyntaxHighlighter/scripts/shAutoloader.js" type="text/javascript"></script>
<link href="PathToSyntaxHighlight/SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="PathToSyntaxHighlight/SyntaxHighlighter/styles/TheStyleYouWant" rel="stylesheet" type="text/css" />

Remplacez 'PathToSyntaxHighlight' par l'adresse du dossier SyntaxHighlight

Remplacez 'TheStyleYouWant' par le nom du fichier de style que vous souhaitez utiliser

Dans onLoad ou en fin de page :

<script type="text/javascript">
<!--
function path() {
    var args = arguments, result = [];
    for(var i = 0; i < args.length; i++)
        result.push(args[i].replace("@", "PathToSyntaxHighlight/SyntaxHighlighter/scripts/"));
    return result
};
SyntaxHighlighter.autoloader.apply(null, path(
    "bash	 @shBrushBash.js",
    "csharp  @shBrushCSharp.js",
    "c       @shBrushCpp.js",
    "css     @shBrushCss.js",
    "diff    @shBrushDiff.js",
    "html    @shBrushXml.js",
    "js      @shBrushJScript.js",
    "java    @shBrushJava.js",
    "perl    @shBrushPerl.js",
    "php     @shBrushPhp.js",
    "text    @shBrushPlain.js",
    "py      @shBrushPython.js",
    "ruby    @shBrushRuby.js",
    "sql     @shBrushSql.js",
    "xml     @shBrushXml.js"
));
SyntaxHighlighter.defaults["toolbar"] = false;
SyntaxHighlighter.all();
-->
</script>

Remplacez 'PathToSyntaxHighlight' par l'adresse du dossier SyntaxHighlight


Licence

SyntaxHighlight est disponible sous licence GNU LESSER GENERAL PUBLIC LICENSE v3 http://www.gnu.org/licenses/lgpl.html


Credits

SyntaxHighlighter by alex Gorbatchev http://alexgorbatchev.com/SyntaxHighlighter/ Licence MIT

Icon by Jigsoar License: Creative Commons (Attribution 3.0 Unported)

syntaxhighlight's People

Contributors

brouillon 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.