Commit graph

11 commits

Author SHA1 Message Date
Martin Fischer
6c5d41e708 [help] introduce searx.user_help.get_variables() 2022-02-05 10:39:32 +01:00
Martin Fischer
33ad043218 [help] introduce API to parse and render Markdown 2022-02-05 10:39:32 +01:00
Martin Fischer
532680be67 [help] convert search_syntax.rst to help page 2022-02-05 10:39:32 +01:00
Martin Fischer
244ffef315 [help] substitute variables with string.Template
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.
2022-02-05 10:35:32 +01:00
Martin Fischer
49d7aa323d [help] move about.md to searx/help/en/ 2022-02-05 10:35:32 +01:00
Martin Fischer
c53c295573 [enh] make searx.user_help use an explicit TOC
When we have multiple help pages we want them
to be displayed in a specific order.
2022-02-01 06:29:22 +01:00
Martin Fischer
fb9eedbf40 [enh] introduce /help route
Translation will be implemented in the future.
For now the "en" in /help/en/<pagename> is hardcoded.
2022-02-01 06:28:26 +01:00
Martin Fischer
08bb3a5f3a [pyright:basic] searx.user_help 2022-02-01 06:28:26 +01:00
Martin Fischer
105c5a6a98 [help] stop rendering documentation with Jinja2
To facilitate translation of the user documentation we move
the templating logic outside of the user documentation.
2022-01-23 08:01:55 +01:00
Martin Fischer
284ac8bfd8 [help] convert about.html to Markdown
To facilitate translation the new user documentation shall be written in
Markdown (which is more human-friendly than HTML and reStructuredText).
2022-01-23 08:01:55 +01:00
Martin Fischer
05149db4c1 [help] render user documentation once on startup
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/)
2022-01-23 08:01:55 +01:00