Skip to content

Commit 01f590d

Browse files
committed
adding a few more examples
1 parent b1e21d9 commit 01f590d

File tree

3 files changed

+214
-170
lines changed

3 files changed

+214
-170
lines changed

example/App.js

Lines changed: 14 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -6,173 +6,8 @@ import Markdown, {
66
renderRules,
77
getUniqueID,
88
} from 'react-native-markdown-renderer';
9-
10-
const markdownText = `
11-
# Syntax Support
12-
13-
__Advertisement :)__
14-
15-
This is a text. Click [here](https://google.com) to open a link. Let's add some more text to see how this behaves.
16-
17-
- __[pica](https://nodeca.github.io/pica/demo/)__ - high quality and fast image
18-
resize in browser.
19-
- __[babelfish](https://github.com/nodeca/babelfish/)__ - developer friendly
20-
i18n with plurals support and easy syntax.
21-
22-
You will like those projects!
23-
24-
---
25-
26-
# h1 Heading 8-)
27-
## h2 Heading
28-
### h3 Heading
29-
#### h4 Heading
30-
##### h5 Heading
31-
###### h6 Heading
32-
33-
34-
### Horizontal Rules
35-
36-
___
37-
38-
---
39-
40-
41-
### Typographic replacements
42-
43-
Enable typographer option to see result.
44-
45-
(c) (C) (r) (R) (tm) (TM) (p) (P) +-
46-
47-
test.. test... test..... test?..... test!....
48-
49-
!!!!!! ???? ,, -- ---
50-
51-
"Smartypants, double quotes" and 'single quotes'
52-
53-
54-
## Emphasis
55-
56-
**This is bold text**
57-
58-
__This is bold text__
59-
60-
*This is italic text*
61-
62-
_This is italic text_
63-
64-
~~Strikethrough~~
65-
66-
67-
## Blockquotes
68-
69-
70-
> Blockquotes can also be nested...
71-
>> ...by using additional greater-than signs right next to each other...
72-
> > > ...or with spaces between arrows.
73-
74-
75-
## Lists
76-
77-
Unordered
78-
79-
+ Create a list by starting a line with \`+\`, \`-\`, or \`*\`
80-
+ Sub-lists are made by indenting 2 spaces:
81-
- Marker character change forces new list start:
82-
* Ac tristique libero volutpat at
83-
+ Facilisis in pretium nisl aliquet
84-
- Nulla volutpat aliquam velit
85-
+ Very easy!
86-
87-
Ordered
88-
89-
1. Lorem ipsum dolor sit amet
90-
2. Consectetur adipiscing elit
91-
3. Integer molestie lorem at massa
92-
93-
94-
1. You can use sequential numbers...
95-
1. ...or keep all the numbers as \`1.\`
96-
97-
Start numbering with offset:
98-
99-
57. foo
100-
1. bar
101-
102-
103-
## Code
104-
105-
Inline \`code\`
106-
107-
Indented code
108-
109-
// Some comments
110-
line 1 of code
111-
line 2 of code
112-
line 3 of code
113-
114-
115-
Block code "fences"
116-
117-
\`\`\`
118-
Sample text here...
119-
\`\`\`
120-
121-
Syntax highlighting
122-
123-
\`\`\` js
124-
var foo = function (bar) {
125-
return bar++;
126-
};
127-
128-
console.log(foo(5));
129-
\`\`\`
130-
131-
## Tables
132-
133-
| Option | Description |
134-
| ------ | ----------- |
135-
| data | path to data files to supply the data that will be passed into templates. |
136-
| engine | engine to be used for processing templates. Handlebars is the default. |
137-
| ext | extension to be used for dest files. |
138-
139-
Right aligned columns
140-
141-
| Option | Description |
142-
| ------:| -----------:|
143-
| data | path to data files to supply the data that will be passed into templates. |
144-
| engine | engine to be used for processing templates. Handlebars is the default. |
145-
| ext | extension to be used for dest files. |
146-
147-
148-
## Links
149-
150-
[link text](http://dev.nodeca.com)
151-
152-
[link with title](http://nodeca.github.io/pica/demo/ "title text!")
153-
154-
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
155-
156-
157-
## Images
158-
159-
![Minion](https://octodex.github.com/images/minion.png)
160-
![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")
161-
162-
Like links, Images also have a footnote style syntax
163-
164-
![Alt text][id]
165-
166-
With a reference later in the document defining the URL location:
167-
168-
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
169-
`;
170-
171-
const markdownText2 = ` # Syntax Support
172-
173-
__Advertisement :)__
174-
175-
This is a text. Click [here](https://google.com) to open a link. Let's add some more text to see how this behaves.`;
9+
import copyAll from "./src/copyAll";
10+
import customMarkdownStyle from "./src/customMarkdownStyle";
17611

17712
/**
17813
* i'm overriding the default h1 render function.
@@ -196,14 +31,23 @@ export default class App extends Component {
19631
view: 0,
19732
};
19833

199-
list = [{ description: 'custom renderer' }, { description: 'custom style sheet' }];
34+
list = [
35+
{ description: 'default' },
36+
{ description: 'custom renderer' },
37+
{ description: 'custom style sheet' }
38+
];
20039

20140
getView(value) {
20241

203-
console.warn(value);
20442
switch (value) {
20543
case 0: {
206-
return <Markdown renderer={renderer.render} children={markdownText} />;
44+
return <Markdown children={copyAll} />;
45+
}
46+
case 1: {
47+
return <Markdown renderer={renderer.render} children={copyAll} />;
48+
}
49+
case 2: {
50+
return <Markdown style={customMarkdownStyle} children={copyAll} />;
20751
}
20852
default: {
20953
return (

example/src/copyAll.js

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
const markdownText = `
2+
# Syntax Support
3+
4+
__Advertisement :)__
5+
6+
This is a text. Click [here](https://google.com) to open a link. Let's add some more text to see how this behaves.
7+
8+
- __[pica](https://nodeca.github.io/pica/demo/)__ - high quality and fast image
9+
resize in browser.
10+
- __[babelfish](https://github.com/nodeca/babelfish/)__ - developer friendly
11+
i18n with plurals support and easy syntax.
12+
13+
You will like those projects!
14+
15+
---
16+
17+
# h1 Heading 8-)
18+
## h2 Heading
19+
### h3 Heading
20+
#### h4 Heading
21+
##### h5 Heading
22+
###### h6 Heading
23+
24+
25+
### Horizontal Rules
26+
27+
___
28+
29+
---
30+
31+
32+
### Typographic replacements
33+
34+
Enable typographer option to see result.
35+
36+
(c) (C) (r) (R) (tm) (TM) (p) (P) +-
37+
38+
test.. test... test..... test?..... test!....
39+
40+
!!!!!! ???? ,, -- ---
41+
42+
"Smartypants, double quotes" and 'single quotes'
43+
44+
45+
## Emphasis
46+
47+
**This is bold text**
48+
49+
__This is bold text__
50+
51+
*This is italic text*
52+
53+
_This is italic text_
54+
55+
~~Strikethrough~~
56+
57+
58+
## Blockquotes
59+
60+
61+
> Blockquotes can also be nested...
62+
>> ...by using additional greater-than signs right next to each other...
63+
> > > ...or with spaces between arrows.
64+
65+
66+
## Lists
67+
68+
Unordered
69+
70+
+ Create a list by starting a line with \`+\`, \`-\`, or \`*\`
71+
+ Sub-lists are made by indenting 2 spaces:
72+
- Marker character change forces new list start:
73+
* Ac tristique libero volutpat at
74+
+ Facilisis in pretium nisl aliquet
75+
- Nulla volutpat aliquam velit
76+
+ Very easy!
77+
78+
Ordered
79+
80+
1. Lorem ipsum dolor sit amet
81+
2. Consectetur adipiscing elit
82+
3. Integer molestie lorem at massa
83+
84+
85+
1. You can use sequential numbers...
86+
1. ...or keep all the numbers as \`1.\`
87+
88+
Start numbering with offset:
89+
90+
57. foo
91+
1. bar
92+
93+
94+
## Code
95+
96+
Inline \`code\`
97+
98+
Indented code
99+
100+
// Some comments
101+
line 1 of code
102+
line 2 of code
103+
line 3 of code
104+
105+
106+
Block code "fences"
107+
108+
\`\`\`
109+
Sample text here...
110+
\`\`\`
111+
112+
Syntax highlighting
113+
114+
\`\`\` js
115+
var foo = function (bar) {
116+
return bar++;
117+
};
118+
119+
console.log(foo(5));
120+
\`\`\`
121+
122+
## Tables
123+
124+
| Option | Description |
125+
| ------ | ----------- |
126+
| data | path to data files to supply the data that will be passed into templates. |
127+
| engine | engine to be used for processing templates. Handlebars is the default. |
128+
| ext | extension to be used for dest files. |
129+
130+
Right aligned columns
131+
132+
| Option | Description |
133+
| ------:| -----------:|
134+
| data | path to data files to supply the data that will be passed into templates. |
135+
| engine | engine to be used for processing templates. Handlebars is the default. |
136+
| ext | extension to be used for dest files. |
137+
138+
139+
## Links
140+
141+
[link text](http://dev.nodeca.com)
142+
143+
[link with title](http://nodeca.github.io/pica/demo/ "title text!")
144+
145+
Autoconverted link https://github.com/nodeca/pica (enable linkify to see)
146+
147+
148+
## Images
149+
150+
![Minion](https://octodex.github.com/images/minion.png)
151+
![Stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat")
152+
153+
Like links, Images also have a footnote style syntax
154+
155+
![Alt text][id]
156+
157+
With a reference later in the document defining the URL location:
158+
159+
[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat"
160+
`;
161+
162+
export default markdownText;

0 commit comments

Comments
 (0)