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