# examples

## Examples

## Example config with [Assemble](http://assemble.io)

In your project's Gruntfile, options for the `{{readme}}` helper can be defined in the Assemble task options:

```javascript
assemble: {
  options: {
    helpers: ['handlebars-helper-readme'],
    readme: {
      cwd: 'path/to/files',
      sep: '<!-- separator defined in Gruntfile -->',
      compare: function (a, b) {
        return a.index >= b.index ? 1 : -1;
      }
    }
  },
  files: {}
}
```

## Usage example

Given you have this config in your project's gruntfile:

```javascript
// Project configuration.
grunt.initConfig({

  // Metadata for our book.
  book: require('./metadata/book.yml'),

  assemble: {
    options: {
      helpers: ['handlebars-helper-readme'],
      readme: {
        sep: '<!-- chapter -->'
      },
      book: {
        src: ['chapters.hbs'],
        dest: 'book/'
      }
    }
  }
});
```

Our `chapters.hbs` file contains the following:

```
{{{readme 'chapters/*.hbs'}}}
```

And the files we want to readme include these Lo-Dash and Handlebars templates:

```
---
title: <%= book.title %>
chapter: 1
intro: Chapter <%= chapter %>
---
<h1>Content from {{title}}</h1>
<p class="intro">{{intro}}</p>
<p class="chapter">Chapter: {{chapter}}</p>
```

The result, `book/chapters.html` would contain something like:

```markup
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>My Amazing Book</title>
  </head>
  <body>

    <!-- chapter -->
    <h1>Content from My Amazing Book</h1>
    <p class="intro">Chapter 1</p>
    <p class="chapter">Chapter: 1</p>

    <!-- chapter -->
    <h1>Content from My Amazing Book</h1>
    <p class="intro">Chapter 2</p>
    <p class="chapter">Chapter: 2</p>

    <!-- chapter -->
    <h1>Content from My Amazing Book</h1>
    <p class="intro">Chapter 3</p>
    <p class="chapter">Chapter: 3</p>
  </body>
</html>
```

### `cwd` example

Instead of writing out full paths, like this:

```
{{readme 'my/book/chapters/*.hbs'}}
{{readme 'my/book/extras/*.hbs'}}
```

Just define a `cwd` in the `readme` options in your project's Gruntfile:

```javascript
assemble: {
  options: {
    helpers: ['handlebars-helper-readme'],
    readme: {
      cwd: 'my/book' // "base" path to prepend
    }
  }
}
```

Now you can define paths in the templates like this:

```
{{readme 'chapters/*.hbs'}}
{{readme 'extras/*.hbs'}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaochen-su.gitbook.io/gitbook_multilanguage_template/node_modules/gitbook-plugin-toc/node_modules/marked-toc/test/fixtures/examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
