Browse Source

[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).
Martin Fischer 3 years ago
parent
commit
284ac8bfd8
4 changed files with 84 additions and 104 deletions
  1. 1 0
      requirements.txt
  2. 0 102
      searx/help/about.html
  3. 80 0
      searx/help/about.md
  4. 3 2
      searx/user_help.py

+ 1 - 0
requirements.txt

@@ -14,3 +14,4 @@ httpx-socks[asyncio]==0.7.2
 langdetect==1.0.9
 setproctitle==1.2.2
 redis==4.1.1
+mistletoe==0.8.1

+ 0 - 102
searx/help/about.html

@@ -1,102 +0,0 @@
-<div{% if rtl %} dir="ltr"{% endif %}>
-  <h1>About <a href="{{ url_for('index') }}">searxng</a></h1>
-
-  <p>
-    SearXNG is a fork from the well-known <a href="https://github.com/searx/searx">searx</a>
-    <a href="https://en.wikipedia.org/wiki/Metasearch_engine"> metasearch engine</a>,
-    aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a>
-    while not storing information about its users.
-  </p>
-
-  <p>More about SearXNG ...</p>
-
-  <ul>
-    <li><a href="{{ searx_git_url }}">SearXNG sources</a></li>
-    <li><a href="https://weblate.bubu1.eu/projects/searxng/">weblate</a></li>
-  </ul>
-
-  <hr />
-
-  <h2>Why use it?</h2>
-
-  <ul>
-    <li>
-      SearXNG may not offer you as personalised results as Google, but it doesn't
-      generate a profile about you.
-    </li>
-    <li>
-      SearXNG doesn't care about what you search for, never shares anything with a
-      third party, and it can't be used to compromise you.
-    </li>
-    <li>
-      SearXNG is free software, the code is 100% open and you can help to make
-      it better.  See more on <a href="{{ searx_git_url
-      }}">SearXNG sources</a>.
-    </li>
-  </ul>
-
-  <p>
-    If you do care about privacy, want to be a conscious user, or otherwise
-    believe in digital freedom, make SearXNG your default search engine or run
-    it on your own server
-  </p>
-
-  <h2>Technical details - How does it work?</h2>
-
-  <p>
-    SearXNG is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>,
-    inspired by the <a href="https://beniz.github.io/seeks/">seeks project</a>.
-
-    It provides basic privacy by mixing your queries with searches on other
-    platforms without storing search data. Queries are made using a POST request
-    on every browser (except Chromium-based browsers*).  Therefore they show up
-    in neither our logs, nor your url history. In the case of Chromium-based
-    browser users there is an exception: searx uses the search bar to perform GET
-    requests.
-
-    SearXNG can be added to your browser's search bar; moreover, it can be set as
-    the default search engine.
-  </p>
-
-  <h2 id='add to browser'>How to set as the default search engine?</h2>
-
-  <p>
-    SearXNG supports <a href="https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md">OpenSearch</a>.
-    For more information on changing your default search engine, see your browser's documentation:
-  </p>
-
-  <ul>
-    <li><a href="https://support.mozilla.org/en-US/kb/add-or-remove-search-engine-firefox">Firefox</a></li>
-    <li><a href="https://support.microsoft.com/en-us/help/4028574/microsoft-edge-change-the-default-search-engine">Microsoft Edge</a></li>
-    <li>Chromium-based browsers <a href="https://www.chromium.org/tab-to-search">only add websites that the user navigates to without a path.</a>
-  </ul>
-
-  <h2>Where to find anonymous usage statistics of this instance ?</h2>
-
-  <p>
-    <a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.
-  </p>
-
-  <h2>How can I make it my own?</h2>
-
-  <p>
-    SearXNG appreciates your concern regarding logs, so take the code from
-    the <a href="{{ searx_git_url }}">SearXNG project</a> and
-    run it yourself!
-  </p>
-  <p>
-    Add your instance to this <a href="{{ get_setting('brand.public_instances') }}"> list of
-    public instances</a> to help other people reclaim their privacy and make the
-    Internet freer!  The more decentralized the Internet is, the more freedom we
-    have!
-  </p>
-
-  <h2>Where are the docs & code of this instance?</h2>
-
-  <p>
-    See the <a href="{{ get_setting('brand.docs_url') }}">SearXNG docs</a>
-    and <a href="{{ searx_git_url }}">SearXNG sources</a>
-  </p>
-
-</div>
-{% include "__common__/aboutextend.html" ignore missing %}

+ 80 - 0
searx/help/about.md

@@ -0,0 +1,80 @@
+# About [searxng][url_for:index]
+
+SearXNG is a fork from the well-known [searx] [metasearch engine], aggregating
+the results of other [search engines][url_for:preferences] while not storing
+information about its users.
+
+More about SearXNG ...
+
+* [SearXNG sources][brand.git_url]
+* [weblate]
+
+---
+
+## Why use it?
+
+* SearXNG may not offer you as personalised results as Google,
+  but it doesn't generate a profile about you.
+
+* SearXNG doesn't care about what you search for, never shares anything
+  with a third party, and it can't be used to compromise you.
+
+* SearXNG is free software, the code is 100% open and you can help
+  to make it better.  See more on [SearXNG sources][brand.git_url].
+
+If you do care about privacy, want to be a conscious user, or otherwise
+believe in digital freedom, make SearXNG your default search engine or run
+it on your own server
+
+## Technical details - How does it work?
+
+SearXNG is a [metasearch engine], inspired by the [seeks project].  It provides
+basic privacy by mixing your queries with searches on other platforms without
+storing search data. Queries are made using a POST request on every browser
+(except Chromium-based browsers*).  Therefore they show up in neither our logs,
+nor your url history. In the case of Chromium-based browser users there is an
+exception: searx uses the search bar to perform GET requests.  SearXNG can be
+added to your browser's search bar; moreover, it can be set as the default
+search engine.
+
+<span id='add to browser'></span>
+## How to set as the default search engine?
+
+SearXNG supports [OpenSearch].  For more information on changing your default
+search engine, see your browser's documentation:
+
+* [Firefox](https://support.mozilla.org/en-US/kb/add-or-remove-search-engine-firefox)
+* [Microsoft Edge](https://support.microsoft.com/en-us/help/4028574/microsoft-edge-change-the-default-search-engine)
+* Chromium-based browsers [only add websites that the user navigates to without a path.](https://www.chromium.org/tab-to-search)
+
+## Where to find anonymous usage statistics of this instance ?
+
+[Stats page][url_for:stats] contains some useful data about the engines used.
+
+## How can I make it my own?
+
+SearXNG appreciates your concern regarding logs, so take the code from
+the [SearXNG project][brand.git_url] and run it yourself!
+
+Add your instance to this [list of public instances][brand.public_instances] to
+help other people reclaim their privacy and make the Internet freer!  The more
+decentralized the Internet is, the more freedom we have!
+
+## Where are the docs & code of this instance?
+
+See the [SearXNG docs][brand.docs_url] and [SearXNG sources][brand.git_url]
+
+[url_for:index]: {{ url_for('index') }}
+[url_for:preferences]: {{ url_for('preferences') }}
+[url_for:stats]: {{ url_for('stats') }}
+[brand.git_url]: {{ searx_git_url }}
+[brand.public_instances]: {{ get_setting('brand.public_instances') }}
+[brand.docs_url]: {{ get_setting('brand.docs_url') }}
+
+[searx]: https://github.com/searx/searx
+[metasearch engine]: https://en.wikipedia.org/wiki/Metasearch_engine
+[weblate]: https://weblate.bubu1.eu/projects/searxng/
+[seeks project]: https://beniz.github.io/seeks/
+[OpenSearch]: https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md
+
+{% include "__common__/aboutextend.html" ignore missing %}

+ 3 - 2
searx/user_help.py

@@ -3,6 +3,7 @@ import os.path
 import pkg_resources
 
 import flask
+import mistletoe
 
 from . import get_setting
 from .version import GIT_URL
@@ -20,7 +21,7 @@ def render(app: flask.Flask):
     """
     for filename in pkg_resources.resource_listdir(__name__, 'help'):
         rootname, ext = os.path.splitext(filename)
-        if ext != '.html':
+        if ext != '.md':
             continue
 
         text = pkg_resources.resource_string(__name__, 'help/' + filename).decode()
@@ -35,4 +36,4 @@ def render(app: flask.Flask):
 
             interpolated = flask.render_template_string(text, get_setting=get_setting, searx_git_url=GIT_URL)
 
-            HELP[rootname] = interpolated
+            HELP[rootname] = mistletoe.markdown(interpolated)