Skip to content

Commit 4dbc5eb

Browse files
committed
bump(*): bump version (@1.0.60-rc.2)
- Add Whitelist/Blacklist capabilities (thanks to @dvisco - #13) - Add block quote(thanks to @ninjz - #15)
1 parent c3f4ef4 commit 4dbc5eb

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

README.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
# react-native-simple-markdown
22
[![Build Status](https://travis-ci.org/CharlesMangwa/react-native-simple-markdown.svg?branch=master)](https://travis-ci.org/CharlesMangwa/react-native-simple-markdown)
33
[![npm version](https://badge.fury.io/js/react-native-simple-markdown.svg)](https://badge.fury.io/js/react-native-simple-markdown)
4-
[![npm](https://img.shields.io/npm/dm/react-native-simple-markdown.svg?maxAge=2592000)]()
4+
[![npm](https://img.shields.io/npm/dm/react-native-simple-markdown.svg?maxAge=2592000)](https://www.npmjs.com/package/react-native-simple-markdown)
55
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badge/)
66

77
A component for rendering Markdown in React Native with native components, working with both iOS & Android. Pull requests are welcome 😃 🎉!
88

99
## Getting started
1010

11-
`npm install react-native-simple-markdown --save`
12-
or
1311
`yarn add react-native-simple-markdown`
1412

1513
## Usage
@@ -104,8 +102,23 @@ Example:
104102
</Markdown>
105103
```
106104
107-
### Features
105+
RNSM also allows you to remove easily unwanted styling options without having to pass in rule objects that have their react key implemented/dummied to ignore those styling options.
106+
107+
Example:
108108
109+
```js
110+
<Markdown
111+
styles={ markdownStyles }
112+
whitelist={['link', 'url']}
113+
>
114+
{ description }
115+
</Markdown>
116+
```
117+
118+
Will only apply the default styles for `link` and `url`. You don't need to pass in a rules prop that contained a key for all the styles you don't want and reimplement their styling output anymore.
119+
120+
### Features
121+
- `blockQuote` (`<View>`) - Also `blockQuoteBar` and `blockQuoteText`
109122
- `br` (`<Text>`)
110123
- `del` (`<Text>`)
111124
- `em` (`<Text>`)
@@ -136,8 +149,7 @@ Example:
136149
_Most of these elements can be used, but I'm still working on some improvements. Pull requests are welcome!_
137150
138151
- `autolink` (`<Text>`)
139-
- `blockQuote` (`<Text>`)
140-
- `codeBlock` (`<View>`)
152+
- `codeBlock` (`<Text>`)
141153
142154
## Credits
143155

rules.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ export default (styles) => ({
1717
blockQuote: {
1818
react: (node, output, state) => {
1919
state.withinText = true
20-
return createElement(Text, {
20+
const blockBar = createElement(View, {
2121
key: state.key,
22-
style: styles.blockQuote
22+
style: [styles.blockQuoteSectionBar, styles.blockQuoteBar]
23+
})
24+
const blockText = createElement(Text, {
25+
key: state.key + 1,
26+
style: styles.blockQuoteText
2327
}, output(node.content, state))
28+
return createElement(View, { key: state.key, style: [styles.blockQuoteSection, styles.blockQuote] }, [blockBar, blockText])
2429
}
2530
},
2631
br: {

styles.js

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
const styles = {
44
view: {},
5+
blockQuoteSection: {
6+
flexDirection: 'row',
7+
},
8+
blockQuoteSectionBar: {
9+
width: 3,
10+
height: null,
11+
backgroundColor: '#DDDDDD',
12+
marginRight: 15,
13+
},
514
codeBlock: {
615
fontFamily: 'Courier',
716
fontWeight: '500',

0 commit comments

Comments
 (0)