front-matter-markdown
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -36,2 +36,5 @@ (function() { | ||
result = result.data; | ||
if (!(result.content || aOptions.content === false)) { | ||
defineProperty(result, 'content', aContent); | ||
} | ||
if (isString(aOptions.heading)) { | ||
@@ -42,5 +45,8 @@ headings = [aOptions.heading]; | ||
} else { | ||
headings = ['toc', 'table of content', 'summary']; | ||
headings = ['toc', /table of content/, 'summary']; | ||
} | ||
compiled = markdown.lexer(aContent); | ||
if (aOptions.content !== false) { | ||
defineProperty(result, '$compiled', compiled); | ||
} | ||
if (aOptions.toc !== false) { | ||
@@ -47,0 +53,0 @@ toc = getTocFromList(compiled, headings); |
{ | ||
"name": "front-matter-markdown", | ||
"description": "get the config and toc object from the markdown string.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/snowyu/front-matter-markdown.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -33,3 +33,3 @@ ## front-matter-markdown [![npm](https://img.shields.io/npm/v/front-matter-markdown.svg)](https://npmjs.org/package/front-matter-markdown) | ||
""" | ||
console.log(parseMarkdown markdownStr) | ||
console.log(JSON.stringify parseMarkdown(markdownStr), null, 1) | ||
``` | ||
@@ -40,2 +40,23 @@ | ||
```bash | ||
{ | ||
"title": "this is a title", | ||
"ordered": false, | ||
"contents": [ | ||
{ | ||
"title": "Directory", | ||
"path": "./dir1", | ||
"ordered": false, | ||
"contents": [ | ||
{ | ||
"title": "Directory2", | ||
"path": "/dir2" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "Directory3", | ||
"path": "#inline" | ||
} | ||
] | ||
} | ||
``` | ||
@@ -52,2 +73,5 @@ | ||
* `aOptions`*(Object)*: | ||
* `content` *(Boolean)*: whether extract the markdown content from configuration. | ||
defaults to true. it will store the compiled markdown to `$compiled` too. | ||
* **Note**: the `content` and `$compiled` attributes are non-enumerable. | ||
* `toc` *(Boolean)*: whether extract the directory from the list in the specified heading. | ||
@@ -54,0 +78,0 @@ defaults to true. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
93482
756
88