Skip to content

Commit bd1a095

Browse files
author
Jonathon Kelly
committed
add initial files
1 parent 9214d27 commit bd1a095

File tree

8 files changed

+129
-1
lines changed

8 files changed

+129
-1
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "react"]
3+
}

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 4
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[{package,bower}.json]
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false
19+
20+
[*.yml]
21+
indent_size = 2

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "airbnb",
3+
4+
"rules": {
5+
"indent": [2, 4, {"SwitchCase": 1}],
6+
"max-len": [2, 140, 2],
7+
8+
"react/jsx-indent-props": [2, 4],
9+
"react/prefer-stateless-function": 0
10+
}
11+
}

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# IntelliJ project files
2+
.idea
3+
*.iml
4+
out
5+
gen
6+
7+
# Dependency directory
8+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
9+
node_modules
10+
11+
# lib
12+
lib

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Jonathon Kelly
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# react-markdown-renderer
1+
# react-markdown-renderer

package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "react-markdown-renderer",
3+
"version": "0.1.0",
4+
"description": "Render markdown as a React component",
5+
"main": "lib/index.js",
6+
"scripts": {
7+
"build": "babel $npm_package_config_entry --out-dir $npm_package_config_output",
8+
"lint": "eslint --ignore-path .gitignore .",
9+
"test": "npm run lint",
10+
"prepublish": "npm run build && npm test"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://[email protected]/InsidersByte/react-markdown-renderer.git"
15+
},
16+
"config": {
17+
"entry": "src",
18+
"output": "lib",
19+
"mainFile": "src/index.js"
20+
},
21+
"author": "Jonathon Kelly <[email protected]>",
22+
"license": "MIT",
23+
"bugs": {
24+
"url": "https://github.com/InsidersByte/react-markdown-renderer/issues"
25+
},
26+
"homepage": "https://github.com/InsidersByte/react-markdown-renderer#readme",
27+
"peerDependencies": {
28+
"react": ">=0.14.7"
29+
},
30+
"dependencies": {
31+
"marked": "^0.3.5"
32+
},
33+
"devDependencies": {
34+
"babel-core": "^6.7.2",
35+
"babel-preset-es2015": "^6.6.0",
36+
"babel-preset-react": "^6.5.0",
37+
"eslint": "^2.4.0",
38+
"eslint-config-airbnb": "^6.1.0",
39+
"eslint-plugin-react": "^4.2.1"
40+
}
41+
}

src/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import marked from 'marked';
3+
4+
class MarkdownRenderer extends React.Component {
5+
render() {
6+
const html = marked(this.props.markdown || '', { sanitize: true });
7+
8+
return (
9+
<div className={this.props.className} dangerouslySetInnerHTML={{ __html: html }}></div>
10+
);
11+
}
12+
}
13+
14+
MarkdownRenderer.propTypes = {
15+
markdown: React.PropTypes.string.isRequired,
16+
className: React.PropTypes.string,
17+
};
18+
19+
export default MarkdownRenderer;

0 commit comments

Comments
 (0)