Skip to content

Commit

Permalink
fix(hast-util-to-jsx.js): files with one element thowes error
Browse files Browse the repository at this point in the history
change the check to test that ther is more that 1 element, to more that 0 elements.
  • Loading branch information
thorecaspersen committed Jul 18, 2019
1 parent bb346b8 commit 6a74a84
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions input/3.development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: react development env
---

# react development env
2 changes: 1 addition & 1 deletion lib/hastUtilToJsx.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function renderNode(ctx, node, index, parent) {
}

// if it goes in to this if, its because its the last run. And element.allNotes is every elements in one string
if (type === "root" && node.children.length > 1) {
if (type === "root" && node.children.length > 0) {
let wrapperName = ctx.wrapper === "fragment" ? "React.Fragment" : "div";

// if the wrapper for body is set, the its gonna overwrite the wrapperName
Expand Down
2 changes: 1 addition & 1 deletion output/1.testmarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const frontMatter = {
quantity: 834
};

export default class Testmarkdown extends React.PureComponent {
export default class Print extends React.PureComponent {
render() {
const props = this.props;
return (
Expand Down
20 changes: 20 additions & 0 deletions output/3.development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*---
react development env
---*/
import React from 'react';
import headline from 'semantic-ui-react/headline';

const frontMatter = {
title: 'react development env'
};

export default class Print extends React.PureComponent {
render() {
const props = this.props;
return (
<div>
<headline>react development env</headline>
</div>
);
}
}

0 comments on commit 6a74a84

Please sign in to comment.