diff --git a/Home.md b/Home.md index af7d9f7..fee69a0 100644 --- a/Home.md +++ b/Home.md @@ -10,6 +10,7 @@ ## developer documentation * [Translation guide](https://github.com/asciimoo/searx/wiki/Translation) +* [Plugins](https://github.com/asciimoo/searx/wiki/Plugins) * [Compiling Styles](https://github.com/asciimoo/searx/wiki/Styles) * [Compiling Javascripts](https://github.com/asciimoo/searx/wiki/Grunt-for-the-javascript-files) @@ -19,4 +20,4 @@ #### brainstorming * [Database structure](https://github.com/asciimoo/searx/wiki/database-structure) -* [Infoboxes brainstorming](https://github.com/asciimoo/searx/wiki/Infoboxes-brainstorming) \ No newline at end of file +* [Infoboxes brainstorming](https://github.com/asciimoo/searx/wiki/Infoboxes-brainstorming) diff --git a/Plugins.md b/Plugins.md new file mode 100644 index 0000000..7489c45 --- /dev/null +++ b/Plugins.md @@ -0,0 +1,34 @@ +## Plugins + +Plugins can extend/replace functionality of various components inside searx. + +### example_plugin.py + +```python +name = 'Example plugin' +description = 'This plugin extends the suggestions with the word "example"' +default_on = False # disable by default + + +# attach callback to the post search hook +# request: flask request object +# ctx: the whole local context of the post search hook +def post_search(request, ctx): + ctx['search'].suggestions.add('example') + return True +``` + + +### Currently implemented plugin entry points (a.k.a hooks) + + * Pre search hook (`pre_search`) + * Post search hook (`post_search`) + +Feel free to add more hooks to the code if it is required by a plugin. + + +### TODO + + * Client side dependency handling + * Better documentation + * More hooks