Skip to content

Commit 7f7ab94

Browse files
committed
- removing example code, was not working. @todo make new example
- updating README.md
1 parent 820a4ba commit 7f7ab94

File tree

12 files changed

+80
-7228
lines changed

12 files changed

+80
-7228
lines changed

README.md

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
1-
# (beta) React Native Markdown Renderer
2-
3-
React Native 100% compatible CommonMark renderer, this renderer uses markdown-it as
4-
its base to tokenise the markdown, after that a ast is generated and given to the AstRenderer.
1+
# React Native Markdown Renderer
2+
3+
Is a 100% compatible CommonMark renderer, a react-native markdown renderer done right. This is __not__
4+
a web-view markdown renderer but a renderer that uses native components for all its elements. These components can be overwritten when needed as seen in the examples.
5+
6+
To give a summary of the supported syntax react-native-markdown-renderer supports.
7+
8+
- Tables
9+
- Heading 1 > 6
10+
- Horizontal Rules
11+
- Typographic replacements
12+
- Emphasis ( **bold**, *italic*, ~~strikethrough~~ )
13+
- Blockquotes
14+
- Lists
15+
- Ordered
16+
57. Unordered
17+
2. foo
18+
3. bar
19+
- Code Blocks
20+
- Syntax highlighting
21+
- Links
22+
- Images
23+
- Plugins for extra syntax support, [see plugins](https://www.npmjs.com/browse/keyword/markdown-it-plugin). Because this markdown-renderer uses markdown-it as its base it also supports all its plugins and subsequent extra language support.
24+
525

6-
**Project has been tested on:**
26+
### tested on:
727

8-
| react | react-native |
9-
| ---- | ------- |
10-
| 16.0.0-alpha.12 | 0.45.1 |
11-
| 16.0.0-alpha.6 | 0.44.0 |
28+
| check | react | react-native |
29+
| ---- | ---- | ------- |
30+
| v | 16.0.0-alpha.12 | 0.45.1 |
31+
| v | 16.0.0-alpha.6 | 0.44.0 |
1232

13-
**todo**
33+
### todo
1434
- add styleSheet support
1535
- add styleSheet inheritance support
1636
- ~~adding plugin support~~
1737

18-
You can
38+
### How to:
1939

2040
#### npm
2141
```npm
@@ -26,7 +46,8 @@ npm install -S react-native-markdown-renderer
2646
yarn add react-native-markdown-renderer
2747
```
2848

29-
How to use:
49+
### Example:
50+
##### Simple example
3051
```js
3152

3253
import react from 'react';
@@ -56,7 +77,7 @@ export default class Page extends PureComponent {
5677
}
5778
```
5879

59-
How to use this library with custom renderer:
80+
##### If you want to use your own native elements and styling, and want to add extra plugins:
6081
```js
6182

6283
import react from 'react';
@@ -79,30 +100,30 @@ I'm in a block
79100
/**
80101
* i'm overriding the default h1 render function.
81102
*/
82-
const renderer = new AstRenderer(Object.assign({}, defaultRendererFunctions, {
83-
h1: (node, children) => {
103+
const renderer = new AstRenderer({
104+
...defaultRendererFunctions,
105+
h1: (node, children, parents) => {
84106
return <Text style={{backgroundColor: 'red'}}>{children}</Text>;
85107
},
86-
// added custom block element
87-
block: (node, children) => {
108+
// added custom block element defined by plugin
109+
block: (node, children, parents) => {
88110
return <Text style={{backgroundColor: 'green'}}>{children}</Text>;
89111
}
90-
}));
112+
});
91113

92114
export default class Page extends PureComponent {
93115

94116
static propTypes = {};
95117
static defaultProps = {};
96-
97-
markdownPlugins = [
98-
new PluginContainer(blockPlugin, 'block', {})
99-
];
100118

101119
render() {
102120

121+
const plugins = [
122+
new PluginContainer(blockPlugin, 'block', {})
123+
];
103124

104125
return (
105-
<Markdown renderer={renderer} plugins={this.markdownPlugins}>{copy}</Markdown>
126+
<Markdown renderer={renderer} plugins={plugins}>{copy}</Markdown>
106127
);
107128
}
108129
}
@@ -111,7 +132,7 @@ export default class Page extends PureComponent {
111132
---
112133

113134

114-
## Syntax Support
135+
# Syntax Support
115136

116137
__Advertisement :)__
117138

examples/.babelrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/.flowconfig

Lines changed: 0 additions & 63 deletions
This file was deleted.

examples/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/.watchmanconfig

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/App.js

Lines changed: 0 additions & 181 deletions
This file was deleted.

examples/App.test.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)