'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _marked = require('marked');

var _marked2 = _interopRequireDefault(_marked);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Markdown = function Markdown(_ref) {
  var markdown = _ref.markdown,
      options = _ref.options;

  _marked2.default.setOptions(Object.assign({
    renderer: new _marked2.default.Renderer(),
    gfm: true,
    tables: true,
    breaks: false,
    pedantic: false,
    sanitize: true,
    smartLists: false,
    smartypants: false
  }, options));
  var renderMarkdown = function renderMarkdown(markdown) {
    return { __html: (0, _marked2.default)(markdown) };
  };
  // sanitized with marked
  // eslint-disable-next-line
  return _react2.default.createElement('div', { dangerouslySetInnerHTML: renderMarkdown(markdown) });
}; /* eslint no-unused-vars: 0 */


Markdown.propTypes = {
  markdown: _propTypes2.default.string,
  options: _propTypes2.default.objectOf(_propTypes2.default.bool)
};

Markdown.defaultProps = {
  markdown: '',
  options: {}
};

exports.default = Markdown;