Illustration
Refining the addition of question/answer capabilities to the website.
  • The objective is to add an efficient way for the author to include question and answer capabilities in articles.
  • The association between the question and the answer should be clear to the author, the reader, and the computer.
  • The reader should have the answer hidden by default with the possibility to make it visible.
  • For a given article, there should be a way to make all answers visible or hidden.

An author may add a question/answer element just like any other HTML element using this markup:

<x-qa> <x-q id="UUID1"> <p>Arbitrary markup for the question.</p> </x-q> <x-a id="UUID2"> <p>Arbitrary markup for the answer.</p> </x-a> </x-qa>

The UUIDs are generated: the author does not have to care about them. Rendered into the page, we have:

Arbitrary markup for the question.

Arbitrary markup for the answer.

The association between question and answer is clear to:

  • the author since there is x-qa markup that explicitly defines the associations;
  • the reader since one appears just after the other and reacts to the show and hide buttons;
  • the computer since the x-qa markup is parsed where the first leaf is the question and others are answers. The association is made independent of human interpretations thanks to the UUIDs.