UNPKG

handlebars-helper-compose

Version:

{{compose}} handlebars helper. Inlines content from multiple files optionally using wildcard (globbing/minimatch) patterns, extracts YAML front matter to pass to context for each file. Accepts compare function as 3rd parameter for sorting inlined files. Good for blog posts, chapters, etc.

118 lines (114 loc) 4.82 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Table of Contents</title> <link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.min.css"> </head> <body> <div class="container bs-docs-container"> <h1>Table of Contents</h1> <!-- post --> <p class="title">My Amazing Book</p> <p class="description">this is a description from &quot;toc.md&quot;</p> <p> <a class="anchor" href="#something-random-chapter-1"></a> <h2 class="blog-title">My Brilliant Blog</h2> <h3 class="post-title" id="My Amazing Book">My Amazing Book</h3> <h3 class="post-slug" id="something-random-chapter-1">something-random-chapter-1</h3> <p class="post-content"> <h1>Content from My Amazing Book</h1> </p> <p class="intro">Chapter 1</p> <p class="chapter">Chapter: 1</p> </p> <div class="root-context"> <span class="filename">filename: something-random-chapter-1.md</span> <span class="pagename">pagename: something-random-chapter-1.md</span> <span class="basename">basename: something-random-chapter-1</span> <span class="ext">ext: .html</span> </div> <div class="data-object"> <span class="id">id: something-random-chapter-1</span> <span class="filepath">filepath: test/fixtures/book/something-random-chapter-1.md</span> <span class="index">index: 3</span> <span class="number">number: 4</span> <span class="first">first:</span> <span class="prev">prev: 2</span> <span class="next">next: 4</span> <span class="last">last:</span> </div> <ul class="tags"> <li>a</li> <li>b</li> <li>c</li> </ul> <!-- chapter --> <p class="title">My Amazing Book</p> <p class="description">this is a description from &quot;toc.md&quot;</p> <a class="anchor" href="#middle-file-chapter-3"></a> <h2 class="blog-title">My Brilliant Blog</h2> <h3 class="post-title" id="My Amazing Book">My Amazing Book</h3> <h3 class="post-slug" id="middle-file-chapter-3">middle-file-chapter-3</h3> <p class="post-content"> <h1>Content from My Amazing Book</h1> <p class="intro">Chapter 3</p> <p class="chapter">Chapter: 3</p> </p> <div class="root-context"> <span class="filename">filename: middle-file-chapter-3.md</span> <span class="pagename">pagename: middle-file-chapter-3.md</span> <span class="basename">basename: middle-file-chapter-3</span> <span class="ext">ext: .html</span> </div> <div class="data-object"> <span class="id">id: middle-file-chapter-3</span> <span class="filepath">filepath: test/fixtures/book/middle-file-chapter-3.md</span> <span class="index">index: 2</span> <span class="number">number: 3</span> <span class="first">first:</span> <span class="prev">prev: 1</span> <span class="next">next: 3</span> <span class="last">last: true</span> </div> <ul class="tags"> <li>d</li> <li>e</li> <li>f</li> </ul> <!-- chapter --> <p class="title">My Amazing Book</p> <p class="description">this is a description from &quot;toc.md&quot;</p> <a class="anchor" href="#before-another-chapter-2"></a> <h2 class="blog-title">My Brilliant Blog</h2> <h3 class="post-title" id="My Amazing Book">My Amazing Book</h3> <h3 class="post-slug" id="before-another-chapter-2">before-another-chapter-2</h3> <p class="post-content"> <h1>Content from My Amazing Book</h1> <p class="intro">Chapter 2</p> <p class="chapter">Chapter: 2</p> </p> <div class="root-context"> <span class="filename">filename: before-another-chapter-2.md</span> <span class="pagename">pagename: before-another-chapter-2.md</span> <span class="basename">basename: before-another-chapter-2</span> <span class="ext">ext: .html</span> </div> <div class="data-object"> <span class="id">id: before-another-chapter-2</span> <span class="filepath">filepath: test/fixtures/book/before-another-chapter-2.md</span> <span class="index">index: 1</span> <span class="number">number: 2</span> <span class="first">first:</span> <span class="prev">prev: 0</span> <span class="next">next: 2</span> <span class="last">last:</span> </div> <ul class="tags"> <li>a</li> <li>e</li> <li>c</li> </ul> </div> </body> </html>