Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var hljs = this.options.renderingConfig.hljs || window.hljs;
/* Check if HLJS loaded */
if (hljs) {
markedOptions.highlight = function (code, language) {
if (language && hljs.getLanguage(language)) {
return hljs.highlight(language, code).value;
} else {
return hljs.highlightAuto(code).value;
}
};
}
}
// Set options
marked.setOptions(markedOptions);
// Convert the markdown to HTML
var htmlText = marked(text);
// Sanitize HTML
if (this.options.renderingConfig && typeof this.options.renderingConfig.sanitizerFunction === 'function') {
htmlText = this.options.renderingConfig.sanitizerFunction.call(this, htmlText);
}
// Edit the HTML anchors to add 'target="_blank"' by default.
htmlText = addAnchorTargetBlank(htmlText);
// Remove list-style when rendering checkboxes
htmlText = removeListStyleWhenCheckbox(htmlText);
return htmlText;
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
import CM from 'codemirror/lib/codemirror';
import { getCursorState, applyFormat } from '../../utils/editorFormat';
import marked from 'marked/lib/marked';
// import hljs from 'highlight.js/lib/highlight.js';
import key from 'keymaster';
import Icon from 'antd/lib/icon';
import Tooltip from 'antd/lib/tooltip';
import '../../styles/EditIcon.less';
import '../../styles/CodeMirror.less';
marked.setOptions({
renderer: new marked.Renderer()
});
require('codemirror/mode/xml/xml');
require('codemirror/mode/markdown/markdown');
require('codemirror/mode/gfm/gfm');
require('codemirror/mode/javascript/javascript');
require('codemirror/mode/css/css');
require('codemirror/mode/htmlmixed/htmlmixed');
require('codemirror/mode/dockerfile/dockerfile');
require('codemirror/mode/go/go');
require('codemirror/mode/nginx/nginx');
require('codemirror/mode/shell/shell');
require('codemirror/mode/sql/sql');
require('codemirror/mode/swift/swift');
require('codemirror/mode/velocity/velocity');