30
30
</ code > </ pre >
31
31
< h2 id ="sample-output "> Sample output</ h2 >
32
32
< p > You’ll get this JSON output:</ p >
33
- < pre > < code class ="lang-json "> { "< span class ="hljs-attr "> files</ span > ":
34
- { "< span class ="hljs-attr "> components.md</ span > ":
35
- { "< span class ="hljs-attr "> title</ span > ": < span class ="pl-s "> "Components"</ span > ,
36
- "< span class ="hljs-attr "> name</ span > ": < span class ="pl-s "> "components.md"</ span > ,
37
- "< span class ="hljs-attr "> sections</ span > ":
38
- { "< span class ="hljs-attr "> components</ span > ":
39
- { "< span class ="hljs-attr "> id</ span > ": < span class ="pl-s "> "components"</ span > ,
40
- "< span class ="hljs-attr "> title</ span > ": < span class ="pl-s "> "Components"</ span > ,
41
- "< span class ="hljs-attr "> depth</ span > ": < span class ="hljs-number "> 1</ span > },
42
- "< span class ="hljs-attr "> top-header</ span > ":
43
- { "< span class ="hljs-attr "> id</ span > ": < span class ="pl-s "> "top-header"</ span > ,
44
- "< span class ="hljs-attr "> title</ span > ": < span class ="pl-s "> "Top header"</ span > ,
45
- "< span class ="hljs-attr "> depth</ span > ": < span class ="hljs-number "> 3</ span > ,
46
- "< span class ="hljs-attr "> parts</ span > ":
47
- { "< span class ="hljs-attr "> s1</ span > ":
48
- { "< span class ="hljs-attr "> type</ span > ": < span class ="pl-s "> "text"</ span > ,
49
- "< span class ="hljs-attr "> language</ span > ": < span class ="pl-s "> "html"</ span > ,
50
- "< span class ="hljs-attr "> content</ span > ": < span class ="pl-s "> "<p>This is the main header partial.</p>"</ span > },
51
- "< span class ="hljs-attr "> s2</ span > ":
52
- { "< span class ="hljs-attr "> type</ span > ": < span class ="pl-s "> "example"</ span > ,
53
- "< span class ="hljs-attr "> language</ span > ": < span class ="pl-s "> "haml"</ span > ,
54
- "< span class ="hljs-attr "> content</ span > ": < span class ="pl-s "> "= render 'components/top_header'"</ span > } } } } } } }
33
+ < pre > < code class ="lang-json "> { "files":
34
+ { "components.md":
35
+ { "title": "Components",
36
+ "name": "components.md",
37
+ "sections":
38
+ { "components":
39
+ { "id": "components",
40
+ "title": "Components",
41
+ "depth": 1 },
42
+ "top-header":
43
+ { "id": "top-header",
44
+ "title": "Top header",
45
+ "depth": 3,
46
+ "parts":
47
+ { "s1":
48
+ { "type": "text",
49
+ "language": "html",
50
+ "content": "<p>This is the main header partial.</p>" },
51
+ "s2":
52
+ { "type": "example",
53
+ "language": "haml",
54
+ "content": "= render 'components/top_header'" } } } } } },
55
+ "toc": { ... } }
55
56
</ code > </ pre >
56
57
< p > It breaks down like so:</ p >
57
58
< ul >
@@ -93,6 +94,18 @@ <h2 id="parts">Parts</h2>
93
94
< li > < code > content</ code > </ li >
94
95
< li > < code > source</ code > - If it was transpiled, the original source will be stored here.</ li >
95
96
</ ul >
97
+ < h2 id ="table-of-contents "> Table of Contents</ h2 >
98
+ < p > A table of contents will be generated when one of the files is called < code > README.md</ code > . It looks like this:</ p >
99
+ < pre > < code class ="lang-js "> { sections:
100
+ [ { title: < span class ="pl-s "> 'Home'</ span > ,
101
+ source: < span class ="pl-s "> 'index.md'</ span > ,
102
+ url: < span class ="pl-s "> 'index.html'</ span > },
103
+ { title: < span class ="pl-s "> 'Document'</ span > ,
104
+ sections:
105
+ [ { title: < span class ="pl-s "> 'Index'</ span > ,
106
+ source: < span class ="pl-s "> 'index.md'</ span > ,
107
+ url: < span class ="pl-s "> 'index.html'</ span > } ] } ] }
108
+ </ code > </ pre >
96
109
97
110
</ div >
98
111
< div class ="footer-nav ">
@@ -118,6 +131,8 @@ <h2 id="parts">Parts</h2>
118
131
</ li >
119
132
< li class ="heading-item -depth-2 "> < a href ="#parts " class ="hlink link-parts "> Parts</ a >
120
133
</ li >
134
+ < li class ="heading-item -depth-2 "> < a href ="#table-of-contents " class ="hlink link-table-of-contents "> Table of Contents</ a >
135
+ </ li >
121
136
</ ul >
122
137
</ li >
123
138
</ ul >
0 commit comments