Add syntax highlighting for c and bash
parent
c5829b65ea
commit
f7c472d762
@ -1,6 +1,8 @@
|
|||||||
define(['prism'], function (Prism) {
|
define(['prism', 'prism-javascript'], function (Prism) {
|
||||||
return function (text, language) {
|
return function (text, language, cb) {
|
||||||
language = language || 'javascript';
|
language = language || 'javascript';
|
||||||
return Prism.highlight(text, Prism.languages[language]);
|
require(['prism-' + language], function () {
|
||||||
|
return cb(Prism.highlight(text, Prism.languages[language]));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
define(['jquery', 'lib/syntax'], function ($, syntax) {
|
define(['jquery', 'lib/syntax'], function ($, syntax) {
|
||||||
describe('syntax', function () {
|
describe('syntax', function () {
|
||||||
it('→ converts javascript to html', function () {
|
it('→ converts javascript to html', function (done) {
|
||||||
var src = 'function () {console.log("hi");}';
|
var src = 'function () {console.log("hi");}';
|
||||||
var actual = syntax(src);
|
syntax(src, null, function (actual) {
|
||||||
expect($(actual).text()).toBe(src);
|
expect($(actual).text()).toBe(src);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue