Skip to content

Commit

Permalink
Update code block type
Browse files Browse the repository at this point in the history
  • Loading branch information
nosir committed Jun 25, 2016
1 parent f2eb573 commit f41f6aa
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ However, this isn't meant to replace any validation or mask library, you should

#### npm

```
```bash
npm install --save cleave.js
```

#### bower

```
```bash
bower install --save cleave.js
```

Expand All @@ -58,7 +58,7 @@ Then have a text field

Now in your JavaScript

```javascript
```js
var cleave = new Cleave('.input-phone', {
phone: true,
regionCode: '{country}'
Expand All @@ -68,7 +68,7 @@ var cleave = new Cleave('.input-phone', {
More examples: [the demo page](https://github.com)

#### CommonJS (Node.js)
```javascript
```js
var Cleave = require('cleave.js');
require('cleave.js/dist/plugin/cleave-phone.{country}');

Expand All @@ -77,15 +77,15 @@ var cleave = new Cleave(...)

#### AMD

```javascript
```js
require(['cleave.js/dist/cleave.min', 'cleave.js/dist/plugin/cleave-phone.{country}'], function (Cleave) {
var cleave = new Cleave(...)
});
```

## ReactJS usage

```
```js
import React from 'react';
import ReactDOM from 'react-dom';

Expand All @@ -94,7 +94,7 @@ import Cleave from 'cleave.js/react';

Then in JSX:

```
```js
class MyComponent extends React.Component {
onCreditCardChange(event) {
// formatted pretty value
Expand Down Expand Up @@ -133,19 +133,19 @@ See more in documentation: [ReactJS usage](https://github.com/nosir/cleave.js/bl

## Building & Running tests

```
```bash
npm install
```

Build assets

```
```bash
gulp build
```

Run unit tests and lint

```
```bash
gulp mocha && gulp eslint
```

Expand Down
20 changes: 10 additions & 10 deletions doc/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ new Cleave('.my-input', {
});
```

```
```js
// Visa: XXXX XXXX XXXX XXXX
// Amex: XXXX XXXXXX XXXXX
// MasterCard: XXXX XXXX XXXX XXXX
Expand Down Expand Up @@ -71,7 +71,7 @@ new Cleave('.my-input', {
});
```

```
```js
// +61 4XX XXX XXX
// +61 2 XXXX XXXX
// 04XX XXX XXX
Expand Down Expand Up @@ -101,7 +101,7 @@ new Cleave('.my-input', {
});
```

```
```js
['d', 'm', 'Y']: 26/04/1965
['d', 'm', 'y']: 26/04/65
['Y', 'm', 'd']: 1965/04/26
Expand All @@ -121,7 +121,7 @@ new Cleave('.my-input', {
});
```

```
```js
// 1,234,567.89
```

Expand All @@ -144,7 +144,7 @@ new Cleave('.my-input', {
});
```

```
```js
// 123,4567.89
```

Expand All @@ -161,7 +161,7 @@ new Cleave('.my-input', {
});
```

```
```js
// 12,345.6789
```

Expand All @@ -181,7 +181,7 @@ new Cleave('.my-input', {
});
```

```
```js
// 1.234.567,89
```

Expand All @@ -200,7 +200,7 @@ new Cleave('.my-input', {
});
```

```
```js
// XXXX-XXXX-XXXX-XXXX
```

Expand All @@ -218,7 +218,7 @@ new Cleave('.my-input', {
});
```

```
```js
// XX XXXXX XXXXX
```

Expand All @@ -235,7 +235,7 @@ new Cleave('.my-input', {
});
```

```
```js
// 253874 XXX XXX
```

Expand Down
16 changes: 8 additions & 8 deletions doc/reactjs-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
Cleave.js uses ES6 spread / rest feature, so you will need Babel compiler to transfer ES6 code.

If your project doesn't support it, please refer to [Legacy way](#legacyway)
If your project doesn't support it, please refer to [Legacy way](#legacy-way)

First install babel presets:

```
```bash
npm install --save babel-preset-es2015 babel-preset-react babel-preset-stage-0
```

And in `.babelrc`:

```
```json
{
"presets": ["es2015", "stage-0", "react"]
}
```

Now in your ReactJS app:

```
```js
import React from 'react';
import ReactDOM from 'react-dom';

Expand All @@ -38,7 +38,7 @@ import CleavePhone from 'cleave.js/dist/plugin/cleave-phone.{country}';

And define the component:

```
```js
class MyComponent extends React.Component {
constructor(props, context) {
super(props, context);
Expand Down Expand Up @@ -109,7 +109,7 @@ ReactDOM.render(<MyComponent/>, document.getElementById('content'));

If the project doesn't support compiling ES6, just include cleave lib like this. It will expose `Cleave` variable to global:

```
```js
var React = require('...');

require('cleave.js/dist/cleave-react.min');
Expand All @@ -118,7 +118,7 @@ require('cleave.js/dist/plugin/cleave-phone.{country}.js');

And define the component:

```
```js
var MyComponent = React.createClass({
onCreditCardChange: function (event) {
// formatted pretty value
Expand All @@ -142,7 +142,7 @@ var MyComponent = React.createClass({

Alternatively you can shim `Cleave.js` module. In your html:

```
```html
<script src="react/dist/react.min.js"></script>
<script src="react-dom/dist/react-dom.min.js"></script>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"form",
"input"
],
"version": "0.1.1",
"version": "0.1.2",
"author": {
"name": "Max Huang",
"url": "http://github.com/nosir",
Expand Down

0 comments on commit f41f6aa

Please sign in to comment.