# Enable preview of Spring REST Docs snippets in IntelliJ IDEA

Author: [Wim Deblauwe](https://www.wimdeblauwe.com/about/) | Published: 2017-07-24 | Canonical: https://www.wimdeblauwe.com/blog/2017/2017-07-24-enable-preview-of-spring-rest-docs-snippets-in-intellij-idea/

If you use [Spring REST Docs](https://projects.spring.io/spring-restdocs/), you will be using the Asciidoctor `include` directive a lot to include the request and responses that are generated from the unit tests. Drawback is that the [Asciidoctor plugin for IntelliJ IDEA](https://plugins.jetbrains.com/plugin/7391-asciidoc) will not render them by default and looks like this:

![screen shot 2017 07 24 at 14 12 36](https://www.wimdeblauwe.com/images/2017/07/screen-shot-2017-07-24-at-14-12-36.png)

The reason is simple, the `snippets` attribute is only available when running the Maven or Gradle task to build the final documentation.

As a workaround, you can add the following at the top of your document:

```
:snippets: ../../../target/generated-snippets
```

We use the [ifndef directive](http://asciidoctor.org/docs/user-manual/#ifndef-directive) to define the `snippets` attribute in case the build system did not define it yet.

Now the preview works nicely:

![screen shot 2017 07 24 at 14 13 51](https://www.wimdeblauwe.com/images//2017/07/screen-shot-2017-07-24-at-14-13-51.png)

Note that it will only work if you are using default locations for the asciidoc source files and the generated snippets. Adjust the path if you use something else.

