This question is in reference to Atlassian Documentation: Code Block Macro
I created a JavaScript file accoriding to the documentation and added it as a custom language to the Code Block Macro. While I can now actually select this new language for code formatting, an error message pops up when I do so (SyntaxHighligher: Can't find brush for: vhdl). What am I doing wrong here? Below you find my JavaScript file. Thanks a lot!
;(function() { SyntaxHighlighter = SyntaxHighlighter || (typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null); function Brush() { var funcs = 'to_integer to_string'; var types = 'std_logic std_logic_vector'; var keywords = 'abs access after '; this.regexList = [ { regex: /--(.*)$/gm, css: 'comments' }, { regex: regexLib.multiLineCComments, css: 'comments' }, { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, { regex: new RegExp(this.getKeywords(types), 'gmi'), css: 'color1' }, { regex: new RegExp(this.getKeywords(keywords), 'gmi'),css: 'keyword' } ]; }; Brush.prototype = new SyntaxHighlighter.Highlighter(); Brush.aliases = ['vhdl', 'Vhdl', 'VHDL']; SyntaxHighlighter.brushes.vhdl = Brush; typeof(exports) != 'undefined' ? exports.Brush = Brush : null; })();
Community moderators have prevented the ability to post new answers.
I did the same as you, and it didn't work. But following the example from http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/custom.html linked from the docs made it work.
Following that example, your highlighter would be:
SyntaxHighlighter.brushes.Custom = function()
{
var funcs = 'to_integer to_string';
var types = 'std_logic std_logic_vector';
var keywords = 'abs access after ';
this.regexList = [
{ regex: /--(.*)$/gm, css: 'comments' },
{ regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' },
{ regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
{ regex: new RegExp(this.getKeywords(types), 'gmi'), css: 'color1' },
{ regex: new RegExp(this.getKeywords(keywords), 'gmi'),css: 'keyword' }
];
};
SyntaxHighlighter.brushes.Custom.prototype = new SyntaxHighlighter.Highlighter();
SyntaxHighlighter.brushes.Custom.aliases = ['vhdl', 'Vhdl', 'VHDL'];
Thanks for the hint. I followed your description - downloaded the source of the plugin, made the changes, compiled & packaged everything, and installed the macro using the confluence web-interface. However, the error still remains - "can't find brush for: vhdl".
Any ideas? I don't understand why the brush cannot be found. It's the same code as for all other supported languages, I double and triple checked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe this is a bug with Confluence: https://jira.atlassian.com/browse/CONF-40838.
I ran into this and had to resort to downloading the source at https://bitbucket.org/atlassian/confluence-newcode-macro-plugin. After placing the brush script in resources/sh/scripts/, adding the script as a resource in atlassian-plugin.xml, inserting an entry in the friendlyNameMap in the BuiltInLanguageInstaller class, packaging and installing the jar as a plugin, it finally worked. It was a lot more effort than it should have been and I hope the bug is fixed soon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.