Jump to content

How to change editor's syntax highlight code


Jonatas Caram

Recommended Posts

Posted

Hello my Friends, I am using the plugin of CKEditor "codesnippetgeshi" for my community why I need of programmation language specifice (Autoit) , I follow this tutorial to configure ("http://docs.ckeditor.com/#!/guide/dev_codesnippetgeshi" )

Editing the file "config.js" of CkEditor, Adding the following line of code : 

CKEDITOR.replace('editor1', {
    extraPlugins: 'codesnippetgeshi',
    codeSnippetGeshi_url: '../lib/colorize.php'
});

However the "editor1" do not is found (I do not know what "id" I should put there)

So I adding into CKEDITOR.editorConfig (inside file "config.js")

CKEDITOR.editorConfig = function(a) {
    a.toolbarGroups = [{
        name: "document",
        groups: ["mode", "document", "doctools"]
    }, {
        name: "clipboard",
        groups: ["clipboard", "undo"]
    }, {
        name: "editing",
        groups: ["find", "selection", "spellchecker"]
    }, {
        name: "forms"
    }, {
        name: "basicstyles",
        groups: ["basicstyles", "cleanup"]
    }, {
        name: "paragraph",
        groups: ["list", "indent", "blocks", "align", "bidi"]
    }, {
        name: "links"
    }, {
        name: "insert"
    }, {
        name: "styles"
    }, {
        name: "colors"
    }, {
        name: "tools"
    }, {
        name: "others"
    }, {
        name: "about"
    }];
    a.removeButtons = "Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript";
    a.removeDialogTabs = "link:advanced"

    a.extraPlugins = "codesnippet,codesnippetgeshi,sourcedialog"; //add this line
    a.codeSnippetGeshi_url = "../lib/colorize.php"; //add this line

};

And it only works when I am editing the post (image below)

edit.thumb.PNG.e584f3a78e7539cff0260841bb9c0bf3.PNG

however when I submit the post the Syntaxe Highlight don't work (image below)

subimit.thumb.PNG.32bd56dd573d8ce5dc8284863ba75660.PNG

 

Does anyone know how I'll fixe this?

Posted

I think the problem here is the syntax highlighting plugin is only working in CKEditor, and not when the posts are displayed on the site. Are the classes used for styling the code available when viewing the posts containing the code?

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...