Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
4ok committed Apr 7, 2016
1 parent c0e2352 commit 36245c1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 39 deletions.
67 changes: 29 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<a name="dependencies"></a>
## Зависимости

- [lodash](https://www.npmjs.com/package/lodash)
- [marked](https://github.com/4ok/marked)
- [escape-html](https://github.com/component/escape-html)
- [markdown-converter](https://github.com/4ok/markdown-converter)

<a name="installation"></a>
## Установка
Expand All @@ -43,34 +43,32 @@ git clone https://github.com/bem-contrib/markdown-bemjson.git

```javascript

// Классический путь
var MarkdownBemjson = require('markdown-bemjson');
var markdownBemjson = new MarkdownBemjson();
const MarkdownBemjson = require('markdown-bemjson');
const markdownBemjson = new MarkdownBemjson();

// Тоже самое, но с сахаром
var markdownBemjson = require('markdown-bemjson')();

var markdown = 'I am using __markdown__';
var bemjson = markdownBemjson.convert(markdown);
const markdown = 'I am using __markdown__';
const bemjson = markdownBemjson.convert(markdown);

console.log(bemjson);
/*
```
В результате получим следующий bemjson:

```json
{
block: 'content',
content : [
"block": "content",
"content" : [
{
elem : 'p',
content : [
'I am using ',
"elem" : "p",
"content" : [
"I am using ",
{
elem : 'strong',
content : ['markdown']
"elem" : "strong",
"content" : ["markdown"]
}
]
}
]
}
*/
```

<a name="manual"></a>
Expand Down Expand Up @@ -170,25 +168,18 @@ Type: `function|string`
#### Пример правил:

```javascript
function (options) {
return {
paragraph : function (text) {

return {
elem : 'p',
content : text
}
},

heading : function (text, level, raw) {

return {
elem : 'header',
elemMods : {
level : level
},
content : text
}
{
paragraph() {
return {
elem : 'p',
content : text
}
},

heading() {
return {
elem : 'h' + level,
content : text
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "markdown-bemjson",
"version": "3.0.0",
"version": "3.0.1",
"description": "Markdown to bemjson converter",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit 36245c1

Please sign in to comment.