markdown-to-jsx
Advanced tools
Comparing version 6.6.1 to 6.6.2
@@ -26,2 +26,4 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
/** TODO: Drop for React 16? */ | ||
@@ -73,2 +75,4 @@ var ATTRIBUTE_TO_JSX_PROP_MAP = { | ||
var DO_NOT_PROCESS_HTML_ELEMENTS = ['style', 'script']; | ||
/** | ||
@@ -151,3 +155,3 @@ * the attribute extractor regex looks for a valid attribute name, | ||
*/ | ||
var HTML_BLOCK_ELEMENT_R = /^ *<([^ >/]+) ?([^>]*)\/{0}>\s*((?:<\1>[\s\S]*<\/\1>|(?!<\1)[\s\S])*)<\/\1>\n*/; | ||
var HTML_BLOCK_ELEMENT_R = /^ *<([^ >/]+) ?([^>]*)\/{0}>\s*((?:<\1>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/; | ||
@@ -933,3 +937,3 @@ var HTML_COMMENT_R = /^<!--.*?-->/; | ||
*/ | ||
content: parseFunc(_parse4, capture[3].replace(TRIM_HTML, ''), state), | ||
content: DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(capture[1]) !== -1 ? capture[3] : parseFunc(_parse4, capture[3].replace(TRIM_HTML, ''), state), | ||
@@ -943,3 +947,3 @@ tag: capture[1] | ||
_extends({ key: state.key }, node.attrs), | ||
output(node.content, state) | ||
DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(node.tag) !== -1 ? node.content : output(node.content, state) | ||
); | ||
@@ -1437,4 +1441,8 @@ } | ||
function Markdown(props) { | ||
return compiler(props.children, props.options); | ||
function Markdown(_ref) { | ||
var children = _ref.children, | ||
options = _ref.options, | ||
props = _objectWithoutProperties(_ref, ['children', 'options']); | ||
return _react2.default.cloneElement(compiler(children, options), props); | ||
} | ||
@@ -1441,0 +1449,0 @@ |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
/* @jsx h */ | ||
@@ -58,2 +60,4 @@ /** | ||
var DO_NOT_PROCESS_HTML_ELEMENTS = ['style', 'script']; | ||
/** | ||
@@ -136,3 +140,3 @@ * the attribute extractor regex looks for a valid attribute name, | ||
*/ | ||
var HTML_BLOCK_ELEMENT_R = /^ *<([^ >/]+) ?([^>]*)\/{0}>\s*((?:<\1>[\s\S]*<\/\1>|(?!<\1)[\s\S])*)<\/\1>\n*/; | ||
var HTML_BLOCK_ELEMENT_R = /^ *<([^ >/]+) ?([^>]*)\/{0}>\s*((?:<\1>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/; | ||
@@ -918,3 +922,3 @@ var HTML_COMMENT_R = /^<!--.*?-->/; | ||
*/ | ||
content: parseFunc(_parse4, capture[3].replace(TRIM_HTML, ''), state), | ||
content: DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(capture[1]) !== -1 ? capture[3] : parseFunc(_parse4, capture[3].replace(TRIM_HTML, ''), state), | ||
@@ -928,3 +932,3 @@ tag: capture[1] | ||
_extends({ key: state.key }, node.attrs), | ||
output(node.content, state) | ||
DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(node.tag) !== -1 ? node.content : output(node.content, state) | ||
); | ||
@@ -1422,4 +1426,8 @@ } | ||
export default function Markdown(props) { | ||
return compiler(props.children, props.options); | ||
export default function Markdown(_ref) { | ||
var children = _ref.children, | ||
options = _ref.options, | ||
props = _objectWithoutProperties(_ref, ['children', 'options']); | ||
return React.cloneElement(compiler(children, options), props); | ||
} | ||
@@ -1426,0 +1434,0 @@ |
14
index.js
@@ -56,2 +56,4 @@ /* @jsx h */ | ||
const DO_NOT_PROCESS_HTML_ELEMENTS = ['style', 'script']; | ||
/** | ||
@@ -134,3 +136,3 @@ * the attribute extractor regex looks for a valid attribute name, | ||
*/ | ||
const HTML_BLOCK_ELEMENT_R = /^ *<([^ >/]+) ?([^>]*)\/{0}>\s*((?:<\1>[\s\S]*<\/\1>|(?!<\1)[\s\S])*)<\/\1>\n*/; | ||
const HTML_BLOCK_ELEMENT_R = /^ *<([^ >/]+) ?([^>]*)\/{0}>\s*((?:<\1>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/; | ||
@@ -975,3 +977,5 @@ const HTML_COMMENT_R = /^<!--.*?-->/; | ||
*/ | ||
content: parseFunc(parse, capture[3].replace(TRIM_HTML, ''), state), | ||
content: DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(capture[1]) !== -1 | ||
? capture[3] | ||
: parseFunc(parse, capture[3].replace(TRIM_HTML, ''), state), | ||
@@ -984,3 +988,3 @@ tag: capture[1], | ||
<node.tag key={state.key} {...node.attrs}> | ||
{output(node.content, state)} | ||
{DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(node.tag) !== -1 ? node.content : output(node.content, state)} | ||
</node.tag> | ||
@@ -1475,4 +1479,4 @@ ); | ||
export default function Markdown (props) { | ||
return compiler(props.children, props.options); | ||
export default function Markdown ({ children, options, ...props }) { | ||
return React.cloneElement(compiler(children, options), props); | ||
} | ||
@@ -1479,0 +1483,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "6.6.1", | ||
"version": "6.6.2", | ||
"engines": { | ||
@@ -9,0 +9,0 @@ "node": ">= 4" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240385
3835