0.2.0 • Published 11 years ago
toccan v0.2.0
toccan
Simple tool for converting md to canner.json
Install
npm install -g toccan
Cli Arguments
For instance
toccan test/test.md -o ./test/canner.json
-o
: output, output canner.json path. Default : ./canner.json
-l
: layout, layout setting in canner.json. Default: ./layout.hbs
-f
: filename, filename setting in canner.json. Default: ./index.html
-m
: max header, max header for parsing TOC. Default: 4
Example
# Test
## title1
content here
### sub-title
sub content here
## title2
content here
### sub-title
sub content here
to canner.json
{
"layout": "./layout.hbs",
"filename": "./index.html",
"data": {
"content": [{
"rank": 1,
"name": "Test",
"line": 0,
"content": "wow\n",
"instance": 0,
"anchor": "[Test](#test)",
"rawAnchor": "test"
}, {
"rank": 2,
"name": "title1",
"line": 3,
"content": "content here\n",
"instance": 0,
"anchor": "[title1](#title1)",
"rawAnchor": "title1"
}, {
"rank": 3,
"name": "sub-title",
"line": 6,
"content": "sub content here\n",
"instance": 0,
"anchor": "[sub-title](#sub-title)",
"rawAnchor": "sub-title"
}, {
"rank": 2,
"name": "title2",
"line": 9,
"content": "content here\n",
"instance": 0,
"anchor": "[title2](#title2)",
"rawAnchor": "title2"
}, {
"rank": 3,
"name": "sub-title",
"line": 12,
"content": "sub content here\n\n",
"instance": 1,
"anchor": "[sub-title](#sub-title-1)",
"rawAnchor": "sub-title-1"
}],
"toc": "- [Test](#test)\n - [title1](#title1)\n - [sub-title](#sub-title)\n - [title2](#title2)\n - [sub-title](#sub-title-1)\n"
}
}
License
MIT