Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix the test

  • Loading branch information...
commit f95217c03439d8889d91cb4a14fe8f16e343b570 1 parent bc11680
@willkan willkan authored
Showing with 30 additions and 24 deletions.
  1. +25 −23 tasks/lib/markdown.js
  2. +5 −1 test/markdown_test.js
View
48 tasks/lib/markdown.js
@@ -34,30 +34,32 @@ exports.init = function(grunt) {
return out.join('\n');
}
- if(typeof options.markdownOptions.highlight === 'string') {
- if(options.markdownOptions.highlight === 'auto') {
- options.markdownOptions.highlight = function(code) {
- var out = hljs.highlightAuto(code).value;
- if(shouldWrap) {
- out = wrapLines(out);
- }
- return out;
- };
- } else if (options.markdownOptions.highlight === 'manual') {
- options.markdownOptions.highlight = function(code, lang) {
- var out = code;
- try {
- out = hljs.highlight(lang, code).value;
- } catch(e) {
- out = hljs.highlightAuto(code).value;
- }
- if(shouldWrap) {
- out = wrapLines(out);
- }
- return out;
- };
- }
+ if(options.markdownOptions && typeof options.markdownOptions === 'object'){
+ if(typeof options.markdownOptions.highlight === 'string') {
+ if(options.markdownOptions.highlight === 'auto') {
+ options.markdownOptions.highlight = function(code) {
+ var out = hljs.highlightAuto(code).value;
+ if(shouldWrap) {
+ out = wrapLines(out);
+ }
+ return out;
+ };
+ } else if (options.markdownOptions.highlight === 'manual') {
+ options.markdownOptions.highlight = function(code, lang) {
+ var out = code;
+ try {
+ out = hljs.highlight(lang, code).value;
+ } catch(e) {
+ out = hljs.highlightAuto(code).value;
+ }
+ if(shouldWrap) {
+ out = wrapLines(out);
+ }
+ return out;
+ };
+ }
+ }
}
markdown.setOptions(options.markdownOptions);
View
6 test/markdown_test.js
@@ -45,7 +45,11 @@ exports['markdown'] = {
options = {
preCompile: noop,
postCompile: noop,
- templateContext: {}
+ templateContext: {},
+ markdownOptions: {
+ gfm: true,
+ highlight: 'manual'
+ }
};
template = defaultTemplate;
file = defaultFile;
Please sign in to comment.
Something went wrong with that request. Please try again.