Skip to content

Commit

Permalink
Fix server-render crash with remarkable in tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinsoftware committed Nov 18, 2018
1 parent 80623ad commit 5fc0b51
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion site/jekyll/tutorials/aspnet4.md
Expand Up @@ -1036,9 +1036,18 @@ class CommentBox extends React.Component {
We also need to update the `Comment` component to use `Remarkable` from either `global` or `window`, due to a bug in Remarkable:

```javascript{3}
function createRemarkable() {
var remarkable =
'undefined' != typeof global && global.Remarkable
? global.Remarkable
: window.Remarkable;
return new remarkable();
}
class Comment extends React.Component {
rawMarkup() {
const md = new (global.Remarkable || window.Remarkable)();
const md = createRemarkable();
const rawMarkup = md.render(this.props.children.toString());
return { __html: rawMarkup };
}
Expand Down
11 changes: 10 additions & 1 deletion site/jekyll/tutorials/aspnetcore.md
Expand Up @@ -1020,9 +1020,18 @@ class CommentBox extends React.Component {
We also need to update the `Comment` component to use `Remarkable` from either `global` or `window`, due to a bug in Remarkable:

```javascript{3}
function createRemarkable() {
var remarkable =
'undefined' != typeof global && global.Remarkable
? global.Remarkable
: window.Remarkable;
return new remarkable();
}
class Comment extends React.Component {
rawMarkup() {
const md = new (global.Remarkable || window.Remarkable)();
const md = createRemarkable();
const rawMarkup = md.render(this.props.children.toString());
return { __html: rawMarkup };
}
Expand Down

0 comments on commit 5fc0b51

Please sign in to comment.