Developer information

Writing documentation

For every new feature, writing documentation is mandatory for the patch to be accepted. The docs are written in an XML dialect similar to XHTML, with a few tags specific to our documentation. For example:

:help :h help]]]]> :help subject ]]]]>

Open help window. The default section is shown unless subject is specified. If you need help for a specific topic, try :help overview.

]]>

creates a new help section for the command :help and for the related key binding, . It also creates help tags for the command, its shortcuts, the key binding, and the general topic, 'help'. These tags enable linking to this section when from other mentions of the topic and from the :help command. The above code displays as:

:help :h help]]> :help subject ]]>

Open help window. The default section is shown unless subject is specified. If you need help for a specific topic, try :help overview.

If you don't know in which file/section you should put some documentation, ask on the mailing list or on #vimperator.

Generating documentation

You can also autogenerate most of the XML help after you have written a new command, mapping or option. For this, use: :echo util.generateHelp(commands.get("addons"), "Extra text")

Writing plugins

Writing &liberator.appname; plugins is incredibly simple. Plugins are simply JavaScript files which run with full chrome privileges and have full access to the &liberator.appname; and &liberator.host; APIs. Each plugin has its own global object, which means that the variables and functions that you create won't pollute the global window or private liberator namespaces. This means that there's no need to wrap your plugin in a closure, as is often the practice in JavaScript development. Furthermore, any plugin which is installed in your runtimepath/plugin directory will find its context stored in plugins.<pluginName>, which is often invaluable during development and testing.

Plugin documentation

Plugins may provide inline documentation, which will appear on the :help plugins page. The markup for help entries is the same as the above, with a few more plugin specific entries. Here is an example from the popular flashblock extension: Kris Maglione MIT

This plugin provides the same features as the ever popular FlashBlock Firefox addon. Flash animations are substituted with place holders which play the original animation when clicked. Additionally, this plugin provides options to control which sites can play animations without restrictions, and triggers to toggle the playing of animation on the current page. commandline from the data in a given form.

'flashblock' 'fb' 'flashblock' 'fb' boolean true

Controls the blocking of flash animations. When true, place holders are substituted for flash animations on untrusted sites.

]]> ; ]]>
The inline XML is made possible by E4X. It's important that the documentation be assigned to the INFO variable, or &liberator.appname; will not be able to find it. The documentation that you provide behaves exactly as other &liberator.appname; documentation, which means that the tags you provide are available via :help with full tag completion and cross-referencing support. Although documentation is not required, we strongly recommend that all plugin authors provide at least basic documentation of the functionality of their plugins and of each of the options, commands, and especially mappings that they provide.