Using tabs in AsciiDoc (Spring Rest Docs)
Asked Answered
L

1

5

I'm using Spring Rest Docs to generate documentation. I would like to do something like Bootstrap's Togglable tabs.

Spring documentation uses togglable tabs, but I don't know how to do it. Here is an example (MockMvc / REST Assured): http://docs.spring.io/spring-restdocs/docs/1.1.0.RELEASE/reference/html5/#documenting-your-api Thanks for helping.

Lingual answered 5/7, 2016 at 20:2 Comment(0)
J
13

There's no built-in support for tabs in Asciidoctor but it's very extensible which allows you to add this sort of thing quite easily.

The tabs in the Spring REST Docs documentation are implemented as a small extension using Groovy, CSS, and Javascript. If you want to take a look at the code, it was added in this commit.

Since that commit was made, the extension's been moved into a separate project. Releases of that project are available from https://repo.spring.io/release. A few details on how to use the extension are available in the README.

Jam answered 5/7, 2016 at 21:2 Comment(3)
This is good stuff, Andy. Do you have an example of using this technique when generating our own documentation with Spring REST Docs?Tangelatangelo
After I originally wrote this answer the extension was moved into a separate project. I've update the answer with a link to the project. It's README provides an example of how it can be used.Jam
Well done, Andy. This works great. I was looking through that old commit yesterday and thinking about doing something like this. Once again, the Spring team is several steps ahead...Tangelatangelo

© 2022 - 2024 — McMap. All rights reserved.