Skip to content

Commit

Permalink
bump(*): bump version (@1.0.60-rc.3)
Browse files Browse the repository at this point in the history
- Add Whitelist/Blacklist capabilities (thanks to @dvisco - #13)
- Add block quote(thanks to @ninjz - #15)
  • Loading branch information
CharlesMangwa committed Dec 4, 2016
1 parent c3f4ef4 commit c5ac34c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
24 changes: 18 additions & 6 deletions README.md
@@ -1,15 +1,13 @@
# react-native-simple-markdown
[![Build Status](https://travis-ci.org/CharlesMangwa/react-native-simple-markdown.svg?branch=master)](https://travis-ci.org/CharlesMangwa/react-native-simple-markdown)
[![npm version](https://badge.fury.io/js/react-native-simple-markdown.svg)](https://badge.fury.io/js/react-native-simple-markdown)
[![npm](https://img.shields.io/npm/dm/react-native-simple-markdown.svg?maxAge=2592000)]()
[![npm](https://img.shields.io/npm/dm/react-native-simple-markdown.svg?maxAge=2592000)](https://www.npmjs.com/package/react-native-simple-markdown)
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badge/)

A component for rendering Markdown in React Native with native components, working with both iOS & Android. Pull requests are welcome 馃槂 馃帀!

## Getting started

`npm install react-native-simple-markdown --save`
or
`yarn add react-native-simple-markdown`

## Usage
Expand Down Expand Up @@ -104,8 +102,23 @@ Example:
</Markdown>
```
### Features
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.
Example:
```js
<Markdown
styles={ markdownStyles }
whitelist={['link', 'url']}
>
{ description }
</Markdown>
```
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.
### Features
- `blockQuote` (`<View>`) - Also `blockQuoteBar` and `blockQuoteText`
- `br` (`<Text>`)
- `del` (`<Text>`)
- `em` (`<Text>`)
Expand Down Expand Up @@ -136,8 +149,7 @@ Example:
_Most of these elements can be used, but I'm still working on some improvements. Pull requests are welcome!_
- `autolink` (`<Text>`)
- `blockQuote` (`<Text>`)
- `codeBlock` (`<View>`)
- `codeBlock` (`<Text>`)
## Credits
Expand Down
9 changes: 7 additions & 2 deletions rules.js
Expand Up @@ -17,10 +17,15 @@ export default (styles) => ({
blockQuote: {
react: (node, output, state) => {
state.withinText = true
return createElement(Text, {
const blockBar = createElement(View, {
key: state.key,
style: styles.blockQuote
style: [styles.blockQuoteSectionBar, styles.blockQuoteBar]
})
const blockText = createElement(Text, {
key: state.key + 1,
style: styles.blockQuoteText
}, output(node.content, state))
return createElement(View, { key: state.key, style: [styles.blockQuoteSection, styles.blockQuote] }, [blockBar, blockText])
}
},
br: {
Expand Down
9 changes: 9 additions & 0 deletions styles.js
Expand Up @@ -2,6 +2,15 @@

const styles = {
view: {},
blockQuoteSection: {
flexDirection: 'row',
},
blockQuoteSectionBar: {
width: 3,
height: null,
backgroundColor: '#DDDDDD',
marginRight: 15,
},
codeBlock: {
fontFamily: 'Courier',
fontWeight: '500',
Expand Down

0 comments on commit c5ac34c

Please sign in to comment.