Part 3.2: Documenting your plugin

This guide covers what you need to document when writing a plugin.

A plugin must include a documentation file that covers how to use the plugin. The documentation will be available from within Funnelback and also the plugin marketplace. Documentation must be written in markdown and supplied as a single readme.md file at the root of the plugin bundle.

Capture basic information

At a minimum, the documentation must cover:

  1. How to enable the plugin

  2. Configuring the plugin

  3. Examples on how to test and see that the plugin is working correctly

  4. Where to go for help

Example readme.md

The example markdown file below documents the title-prefix-plugin.

readme.md
# Plugin: title-prefix-plugin

This plugin cleans search result titles by replacing the start of a title which matches a pattern with a provided pattern. If a replacement is not provided, it will remove the matching part of the title.

## Usage

Add the following to your results page configuration to enable the plugin.

```ini
plugin.title-prefix-plugin.enabled=true
plugin.title-prefix-plugin.version=1.0
```

The following results page settings can be used to configure the plugin:

* `plugin.title-prefix-plugin.config.pattern`: Pattern to look for at the start of each result title
* `plugin.title-prefix-plugin.config.replaceWith`: (Optional) Text to replace the pattern with

If `replaceWith` is not provided, then matching patterns will be removed.

For example, if you were to set the following settings in the results page configuration:

```ini
plugin.title-prefix-plugin.config.pattern=Product Documentation |
plugin.title-prefix-plugin.config.replaceWith=Funnelback Documentation v16 |
```

On any search results for that results page, titles which begin with `'Product Documentation |'` will now start with `'Funnelback Documentation v16'` instead.

Next steps

The next tutorial covers how to write unit tests to test your plugin.