Skip to content

Commit cbaef49

Browse files
committed
Merge upstream
2 parents fd7a79d + e0f1141 commit cbaef49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+10087
-684
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/node_modules
22
/.idea
3-
/examples/node_modules
3+
package-lock.json
4+
/.DS_Store

.npmignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
/examples
2-
/.idea
1+
/example
2+
/.idea
3+
/bin

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"useTabs": false,
3+
"printWidth": 120,
4+
"tabWidth": 2,
5+
"singleQuote": true,
6+
"trailingComma": "es5"
7+
}

README.md

Lines changed: 26 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
# React Native Markdown Renderer
1+
# React Native Markdown Renderer [![npm version](https://badge.fury.io/js/react-native-markdown-renderer.svg)](https://badge.fury.io/js/react-native-markdown-renderer) [![Known Vulnerabilities](https://snyk.io/test/github/mientjan/react-native-markdown-renderer/badge.svg)](https://snyk.io/test/github/mientjan/react-native-markdown-renderer)
22

3-
Is a 100% compatible CommonMark renderer, a react-native markdown renderer done right. This is __not__
3+
Is a 100% compatible CommonMark renderer, a react-native markdown renderer done right. This is __not__
44
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.
55

6-
To give a summary of the supported syntax react-native-markdown-renderer supports.
6+
### Quick links
7+
- [Documentation](https://github.com/mientjan/react-native-markdown-renderer/wiki/)
8+
- [Examples](https://github.com/mientjan/react-native-markdown-renderer/wiki/Examples)
9+
- [Example App](https://github.com/mientjan/react-native-markdown-renderer/wiki/ExampleApp)
10+
11+
12+
### Syntax Support
713

14+
To give a summary of the supported syntax react-native-markdown-renderer supports.
15+
816
- Tables
917
- Heading 1 > 6
1018
- Horizontal Rules
@@ -20,20 +28,21 @@ To give a summary of the supported syntax react-native-markdown-renderer support
2028
- Syntax highlighting
2129
- Links
2230
- 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-
25-
26-
### tested on:
31+
- 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.
2732

28-
| [] | react | react-native |
29-
| ---- | ---- | ------- |
30-
| v | 16.0.0-alpha.12 | 0.45.1 |
31-
| v | 16.0.0-alpha.6 | 0.44.0 |
33+
### Tested on:
3234

33-
### todo
34-
- add styleSheet support
35-
- add styleSheet inheritance support
36-
- ~~adding plugin support~~
35+
| [] | react | react-native | version |
36+
| -- | ----- | ------------ | ------- |
37+
| v | 16.2 | 0.50.4 | 3.0.0 |
38+
| v | 16.0.0-alpha.12 | 0.45.1 | 2.0.5 |
39+
| v | 16.0.0-alpha.6 | 0.44.0 | 2.0.5 |
40+
| x | 15.x | ^0.46.4 | 2.0.5 |
41+
42+
### Todo
43+
- ~~add styleSheet support~~
44+
- ~~add plugin support~~
45+
- ~~add support for seperate rules~~
3746

3847
### How to:
3948

@@ -46,92 +55,10 @@ npm install -S react-native-markdown-renderer
4655
yarn add react-native-markdown-renderer
4756
```
4857

49-
### Example:
50-
##### Simple example
51-
```js
52-
53-
import react from 'react';
54-
import {View, PureComponent} from 'react-native';
55-
import Markdown from 'react-native-markdown-renderer';
56-
57-
const copy = `# h1 Heading 8-)
58-
59-
| Option | Description |
60-
| ------ | ----------- |
61-
| data | path to data files to supply the data that will be passed into templates. |
62-
| engine | engine to be used for processing templates. Handlebars is the default. |
63-
| ext | extension to be used for dest files. |
64-
`;
65-
66-
export default class Page extends PureComponent {
67-
68-
static propTypes = {};
69-
static defaultProps = {};
70-
71-
render() {
72-
73-
return (
74-
<Markdown>{copy}</Markdown>
75-
);
76-
}
77-
}
78-
```
79-
80-
##### If you want to use your own native elements and styling, and want to add extra plugins:
81-
```js
82-
83-
import react from 'react';
84-
import {View, PureComponent, Text} from 'react-native';
85-
import Markdown, { AstRenderer, defaultRendererFunctions, PluginContainer, blockPlugin} from 'react-native-markdown-renderer';
86-
87-
const copy = `# h1 Heading 8-)
88-
89-
| Option | Description |
90-
| ------ | ----------- |
91-
| data | path to data files to supply the data that will be passed into templates. |
92-
| engine | engine to be used for processing templates. Handlebars is the default. |
93-
| ext | extension to be used for dest files. |
94-
95-
[block]
96-
I'm in a block
97-
[/block]
98-
`;
99-
100-
/**
101-
* i'm overriding the default h1 render function.
102-
*/
103-
const renderer = new AstRenderer({
104-
...defaultRendererFunctions,
105-
h1: (node, children, parents) => {
106-
return <Text style={{backgroundColor: 'red'}}>{children}</Text>;
107-
},
108-
// added custom block element defined by plugin
109-
block: (node, children, parents) => {
110-
return <Text style={{backgroundColor: 'green'}}>{children}</Text>;
111-
}
112-
});
113-
114-
export default class Page extends PureComponent {
115-
116-
static propTypes = {};
117-
static defaultProps = {};
118-
119-
render() {
120-
121-
const plugins = [
122-
new PluginContainer(blockPlugin, 'block', {})
123-
];
124-
125-
return (
126-
<Markdown renderer={renderer} plugins={plugins}>{copy}</Markdown>
127-
);
128-
}
129-
}
130-
```
58+
See [WIKI](https://github.com/mientjan/react-native-markdown-renderer/wiki/) for examples and documentation
13159

13260
---
13361

134-
13562
# Syntax Support
13663

13764
__Advertisement :)__
@@ -287,4 +214,4 @@ Like links, Images also have a footnote style syntax
287214

288215
With a reference later in the document defining the URL location:
289216

290-
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
217+
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"

0 commit comments

Comments
 (0)