If you want to offer to your reader a way to test if they understood your documentation you can insert quizzes into your document

Dependencies

Quiz is written in another artifact, so firstly you must include it into your dependencies

dependencies {
    asciidoctor "com.puravida-software.asciidoctor:asciidoctor-quizzes:{extensions-version}"
}

Question

To add questions into your document you must use the inline macro quizquestion

In order to be able to choose between options you must specify the theme in the second part of the macro. As first attribute you must specify how mucho points the answer has:

Groovy is a language similar to

quizquestion:languages[10,java] Java  (1) (2) (3)

quizquestion:languages[5,cplusplus] C++

Choose a prime number quizquestion:primes[1] 7, quizquestion:primes[0] 8, quizquestion:primes[10] 23 (4)
  1. quizquestion is the macro id

  2. languages group all questions with the same name in order to choose the selected

  3. you must to assign points for each answer

  4. another quiz called "primes" is created

Toolbar

To provide a way to validate answer we use quizztoolbar who render a toolbar (currently only a simple button)

quizztoolbar::[value="Validate"] (1)
  1. Currently only value is allowed

Results

To provide a place where show the point obtained for every quiz we use quizzpoints. You can use this inline macro where you want (paragraphs, tables, etc), but pay attention to use the same id you selected for group answers

quizzpoints:theme[]  (1)
  1. theme is the same id you use in quizquestion to group answwers

For example, say we have two quizzes into the page

Groovy is a language similar to

quizquestion:groovy[10,java] Java

quizquestion:groovy[5,cplusplus] C++

quizquestion:groovy[0,cobol] Cobol

and

Choose a prime number. Can be more than one valid answers but one of them has more points

- quizquestion:primes[1] 7,
- quizquestion:primes[0] 8
- quizquestion:primes[10] 23

We can render the results in a table

[cols="2s,1a"]
|===

|Groovy
|quizzpoints:groovy[]

|School, primer numbers
|quizzpoints:primes[]

|===

or show them as independents blocks

Groovy is a language similar to

quizquestion:groovy[10,java] Java

quizquestion:groovy[5,cplusplus] C++

quizquestion:groovy[0,cobol] Cobol

The right awswer is ... quizzpoints:groovy[]

Toolbar customization

The toolbar can be customized using a docinfo with the desired style:

docinfo.html
<style>
    .quizztoolbar-button{
        background-color: #4CAF50; /* Green */
        border: none;
        color: white;
        padding: 15px 32px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 16px;
    }
</style>

Example

If you want to test a full demo Quiz follow this quizzes/quiz1.html