1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Make code blocks more extensible

Discussion in 'Closed Suggestions' started by md_5, Mar 15, 2014.

  1. md_5

    md_5 Well-Known Member

    I am using the excellent Geshi highlighter by @digitalpoint, however many users are unaware that they can actually use Java and YAML syntax highlights. The solution to this is of course to add these to the dropdown menu by editing the template, simple enough.
    However then we run into this code in bb_code_edit.js:
                switch ($('#redactor_code_type').val())
                    case 'html': tag = 'HTML'; break;
                    case 'php':  tag = 'PHP'; break;
                    default:     tag = 'CODE';
    Quite simply, this prevents us from adding new code types without editing core javascript files by hand.
    A more appropriate method would be:
    tag = $('#redactor_code_type').val().toUpperCase()
  2. digitalpoint

    digitalpoint Well-Known Member

    I ended up breaking down and the new version of my syntax highlighter overwrites the insertCode JavaScript method so you can add languages to the editor's code dialog (and they will work... which is the important part).

    It adds JavaScript and CSS by default, but adding any language that GeSHi supports to the template would work.
    md_5 likes this.
  3. Andy.N

    Andy.N Well-Known Member

    I like to add C++ to the list, which template should I edit? tks
  4. digitalpoint

    digitalpoint Well-Known Member

    Andy.N likes this.

Share This Page