-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
39 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"cSpell.language": "en" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,25 @@ | ||
import * as React from 'react'; | ||
import * as remark from 'remark'; | ||
import reactRenderer from 'remark-react'; | ||
import * as html from 'remark-html'; | ||
import remarkReact from 'remark-react'; | ||
|
||
export interface AppState { | ||
text: string; | ||
export interface AppProps { | ||
title: string; | ||
} | ||
|
||
// @ts-ignore | ||
const processor = remark().use(reactRenderer, { | ||
const processor = remark().use(remarkReact, { | ||
prefix: 'md-', | ||
sanitize: true | ||
}) | ||
|
||
export class App extends React.Component<{}, AppState> { | ||
constructor(props: {}) { | ||
super(props); | ||
this.state = { | ||
text: '# hello world' | ||
}; | ||
} | ||
|
||
public onChange(e: React.ChangeEvent<HTMLTextAreaElement>): void { | ||
this.setState({ text: e.target.value }); | ||
} | ||
|
||
export class App extends React.Component<AppProps, {}> { | ||
public render() { | ||
// @ts-ignore | ||
const content = processor.processSync(this.state.text).contents | ||
return content; | ||
const content = { __html: remark().use(remarkReact, { | ||
sanitize: false | ||
}).use(html).processSync(this.props.title).contents }; | ||
return <div dangerouslySetInnerHTML={content} />; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
], | ||
"linterOptions": { | ||
"exclude": [ | ||
"node_modules/**/*.ts" | ||
"node_modules/**" | ||
] | ||
}, | ||
"rules": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface Option {} | ||
|
||
declare function plugin(option: Option): any | ||
|
||
export default plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
interface Parser {} | ||
interface Parser { | ||
use: any | ||
} | ||
interface Options {} | ||
|
||
|
||
|