Online /info

Back to top

Online /info

Render SearXNG instance documentation.

Usage in a Flask app route:

from searx import infopage
from searx.extended_types import sxng_request

_INFO_PAGES = infopage.InfoPageSet(infopage.MistletoePage)

@app.route('/info/<pagename>', methods=['GET'])
def info(pagename):

    locale = sxng_request.preferences.get_value('locale')
    page = _INFO_PAGES.get_page(pagename, locale)

class searx.infopage.InfoPage(fname: str)[source] : A page of the online documentation.

property raw\_content[[source]](https://docs.searxng.org/_modules/searx/infopage.html#InfoPage.raw_content)
:   Raw content of the page (without any jinja rendering)

property content[[source]](https://docs.searxng.org/_modules/searx/infopage.html#InfoPage.content)
:   Content of the page (rendered in a Jinja context)

property title[[source]](https://docs.searxng.org/_modules/searx/infopage.html#InfoPage.title)
:   Title of the content (without any markup)

property html: [str](https://docs.python.org/3/builtins/stdtypes.html#str)[[source]](https://docs.searxng.org/_modules/searx/infopage.html#InfoPage.html)
:   Render Markdown ([CommonMark](https://commonmark.org/)) to HTML by using [markdown-it-py](https://github.com/executablebooks/markdown-it-py).

get\_ctx() → [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)][[source]](https://docs.searxng.org/_modules/searx/infopage.html#InfoPage.get_ctx)
:   Jinja context to render [`InfoPage.content`](#searx.infopage.InfoPage.content)

class searx.infopage.InfoPageSet(page_class: type[InfoPage] | None = None, info_folder: str | None = None)[source] : Cached rendering of the online documentation a SearXNG instance has.

Parameters:
:   - **page\_class** ([`InfoPage`](#searx.infopage.InfoPage)) – render online documentation by [`InfoPage`](#searx.infopage.InfoPage) parser.
    - **info\_folder** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – information directory

folder: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   location of the Markdown files

locale\_default: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   default language

locales: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]
:   list of supported languages (aka locales)

toc: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[str](https://docs.python.org/3/builtins/stdtypes.html#str)]
:   list of articles in the online documentation

get\_page(*pagename: [str](https://docs.python.org/3/builtins/stdtypes.html#str)*, *locale: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None*)[[source]](https://docs.searxng.org/_modules/searx/infopage.html#InfoPageSet.get_page)
:   Return `pagename` instance of [`InfoPage`](#searx.infopage.InfoPage)

    Parameters:
    :   - **pagename** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – name of the page, a value from [`InfoPageSet.toc`](#searx.infopage.InfoPageSet.toc)
        - **locale** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str)) – language of the page, e.g. `en`, `zh_Hans_CN`
          (default: `InfoPageSet.i18n_origin`)

iter\_pages(*locale: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = None*, *fallback\_to\_default: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False*)[[source]](https://docs.searxng.org/_modules/searx/infopage.html#InfoPageSet.iter_pages)
:   Iterate over all pages of the TOC

Copyright © SearXNG team

Made with Furo

💾 🌐