DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:qna

QnA Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" yes
  • 2023-04-04 "Jack Jackrum" yes
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes

plugin Custom formatting for Q&A (FAQ) sections

Last updated on
2023-06-18
Provides
Syntax
Repository
Source
Conflicts with
fastwiki

Similar to faq, wrap

Tagged with boxes, formatting

There are number of ways to organize a FAQ sections on a DokuWiki page that use (abuse) different syntax elements to present the questions and answers. The QnA plugin introduces semantically clear syntax for both questions and answers plus a convenient way to create a table of contents for the FAQ.

Download and Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Syntax

The basic QnA block starts with a question and is followed by one or more optional answers. The questions are marked by triple question mark at the start of a line, the answers — with triple exclamation mark:

??? How do I format a question?
!!! Put triple question mark at the start of a line followed by the question title.

The first line of the question (must be on the same line as the ??? marker) is used as the question title and like DokuWiki headlines does not support any formatting. The rest of the text between the title and the first answer is treated as the question details and can contain almost any DokuWiki syntax (except of headers). This also applies to the answer block — no syntax limitations.

Normally question and answer blocks span until the start of the next block or to the next section. If you want to mix QnA syntax with plain text you can explicitly terminate the block by the question block marker without the question title:

??? How do I terminate a QnA block?
What if I want to put some text after the block and that text doesn't
belong to the answer?

!!! Put triple question mark at the start of a line.
???

This text is not part of the answer.

You can organize multiple questions into sections using slightly modified headline syntax:

=?==== Level 1 headline ======
=?=== Level 2 headline =====
=?== Level 3 headline ====
=?= Level 4 headline ===

The normal headlines are still respected and may be used together with customized ones. The only difference is that they are not shown in the QnA table of contents.

The QnA TOC can be inserted with ~~QNA~~ or ~~FAQ~~ syntax. It will be rendered as an unordered list of all questions on the current page. Note that due to implementation constrains the TOC for the current page may be not properly updated in preview during the page editing. Instead of the current page you can insert TOC for other pages by adding the page names to the ~~QNA~~ syntax:

~~QNA faq:installation faq:sequrity faq:usage~~

When multiple page names are specified the plugin will combine information from all pages into a single TOC.

Configuration

The plugin supports multiple visual styles, and you can select the one you like the most using Configuration Manager. Look for “QnA” in plugin configuration section.

Style customization

All elements rendered by QnA plugin are wrapped into containers with distinct class names. This allows to easily customize their look with a user-defined CSS style sheet. The figure below shows different HTML elements generated by the plugin along with their class attributes:

Styling

Version History

2023-06-18

  • Fixed compatibility with DokuWiki Jack Jackrum

2022-07-06

  • Fixed compatibility with PHP8

2017-09-25

  • Fixed trimming of multibyte characters in question identifiers

2017-07-27

  • Added multiple formatting styles
  • Added configuration option for style selection

2017-06-20

  • Fixed background color selection for question and answer blocks
  • Fixed linking from TOC to QnA sections

2016-02-27

  • Respect ACL during TOC generation
  • Fixed PHP 7 compatibility

2015-02-16

  • Various minor bug fixes

2009-12-13

  • First public release

Bugs and Feature Requests

Please report bugs or feature requests at the bug tracker.

plugin/qna.txt · Last modified: 2024-03-16 03:32 by KaiMartin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki