Skip to content

Commit

Permalink
Merge pull request #97 from probablyup/avoid-prop-mutation
Browse files Browse the repository at this point in the history
5.0.2
  • Loading branch information
quantizor committed Apr 10, 2017
2 parents b0d1a73 + 3a21c24 commit ee31525
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 5.0.2 (April 10, 2017)

62adf46 Refactor object.assign -> spread apply
706ef18 Do not mutate settings object (props @sapegin!)
b0d1a73 Update my author info

---

### 5.0.0 (January 12, 2017)

See the README for updated usage instructions, here's a quick preview:
Expand Down
17 changes: 8 additions & 9 deletions docs/js/bundle.js

Large diffs are not rendered by default.

40 changes: 24 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,19 @@ export function compiler(markdown, {overrides = {}} = {}) {
const key = index || '0';

if (ast.type === 'code' && ast.value) {
const preProps = get(overrides, 'pre.props', {});
const codeProps = get(overrides, 'code.props', {});
const preProps = {
...get(overrides, 'pre.props', {}),
key,
};

preProps.key = key;
codeProps.className = codeProps.className
? `${codeProps.className} lang-${ast.lang}`
: `lang-${ast.lang}`;
const langClassName = `lang-${ast.lang}`;
const codeBaseProps = get(overrides, 'code.props', {});
const codeProps = {
...codeBaseProps,
className: codeBaseProps.className
? `${codeBaseProps.className} ${langClassName}`
: langClassName
};

return React.createElement(
get(overrides, 'pre.component', 'pre'),
Expand Down Expand Up @@ -446,16 +452,18 @@ export function compiler(markdown, {overrides = {}} = {}) {

if (ast.type === 'listItem') {
if (ast.checked === true || ast.checked === false) {
const liProps = get(overrides, 'li.props', {});

liProps.key = key;

const inputProps = get(overrides, 'input.props', {});

inputProps.key = 'checkbox';
inputProps.type = 'checkbox';
inputProps.checked = ast.checked;
inputProps.readOnly = true;
const liProps = {
...get(overrides, 'li.props', {}),
key,
};

const inputProps = {
...get(overrides, 'input.props', {}),
key: 'checkbox',
type: 'checkbox',
checked: ast.checked,
readOnly: true
};

return React.createElement(
get(overrides, 'li.component', 'li'),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Interprets markdown text and outputs a JSX equivalent.",
"homepage": "http://yaycmyk.com/markdown-to-jsx/",
"license": "MIT",
"version": "5.0.1",
"version": "5.0.2",
"engines": {
"node": ">= 4"
},
Expand Down

0 comments on commit ee31525

Please sign in to comment.