Previously help pages could link to instance-specific pages
with e.g. [search engines][url_for:preferences] which was
possible because searx.user_help was prefixing the Markdown:
[url_for:preferences]: /preferences
There are two problems with this:
1. typos in the Markdown files could go by unnoticed
(since Markdown treats [foo][doesntexist] as regular text)
2. it doesn't let Markdown append their own query string
(which would however be handy to link example search
queries to the search page)
This commit addresses both of these problems by using
string.Template from the Python standard library.
Why don't we use Jinja2 for this? Well Jinja2 would be overkill.
We don't need any logic in the user documentation. And in the future
we might outsource the user documentation translation to Weblate,
in which case not permitting any logic in them is more secure.
Currently we have two kinds of user documentation:
* the about page[1] which is written in HTML and part of the web
application and can therefore link instance-specific pages
(like e.g. the preferences) via Jinja variables
* the Sphinx documentation[2] which is written in reStructuredText
and cannot link instance-specific pages since it doesn't know
which instance the user is using
The plan is to integrate the user documentation currently in Sphinx
into the application, so that it can also link instance specific pages.
We also want to enable the user documentation to be translated.
This commit implements the first step in this endeavor (see #722).
[1]: searx/templates/__common__/about.html
[2]: docs/user/ (currently served at https://docs.searxng.org/user/)