mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-18 14:17:30 +00:00
20 lines
468 B
JavaScript
20 lines
468 B
JavaScript
'use strict';
|
|
|
|
var hljs = require('highlight.js'),
|
|
extend = require('extend');
|
|
|
|
/**
|
|
* Highlights the contents of the `example` tag.
|
|
*
|
|
* @name highlight
|
|
* @param {Object} comment parsed comment
|
|
* @return {Object} comment with highlighted code
|
|
*/
|
|
module.exports = function (comment) {
|
|
return extend({}, comment, comment.examples ? {
|
|
examples: comment.examples.map(function (example) {
|
|
return hljs.highlight('js', example).value;
|
|
})
|
|
} : {});
|
|
};
|