diff --git a/docs/source/examples/hero-box.rst b/docs/source/examples/hero-box.rst index e99b621a7..0ca2d774e 100644 --- a/docs/source/examples/hero-box.rst +++ b/docs/source/examples/hero-box.rst @@ -87,6 +87,11 @@ The ``hero-box`` directive supports the following options: - - - If present, adds vertical padding suitable for content pages. By default (without this flag), the hero box is optimized for landing pages. + * - ``ai_chatbot_id`` + - string + - + - my-chatbot-id + - AI chatbot ID to use for the Ask AI button. Requires the ``search_box`` option to be present. Link resolution --------------- @@ -220,6 +225,29 @@ Results in: :search_box: :content_page: +With custom AI chatbot ID +.......................... + +Using: + +.. code-block:: rst + + .. hero-box:: + :title: Lorem Ipsum + :text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. + :search_box: + :ai_chatbot_id: my-custom-chatbot-id + :content_page: + +Results in: + +.. hero-box:: + :title: Lorem Ipsum + :text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. + :search_box: + :ai_chatbot_id: ddfdo8m94k + :content_page: + With bold button ................. diff --git a/docs/source/index.rst b/docs/source/index.rst index 097146547..b62c76d0c 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -12,10 +12,10 @@ .. hero-box:: :button_icon: icon-github :button_style: bold - :button_url: https://github.com/scylladb/sphinx-scylladb-theme - :button_text: Source code :title: Welcome to ScyllaDB Sphinx Theme documentation :image: /_static/img/mascots-2/docs.svg + :search_box: + :ai_chatbot_id: ddfdo8m94k The documentation toolchain for ScyllaDB projects. diff --git a/extensions/sphinx-multiversion/README.md b/extensions/sphinx-multiversion/README.md index fcb2ae624..798e0aee7 100644 --- a/extensions/sphinx-multiversion/README.md +++ b/extensions/sphinx-multiversion/README.md @@ -58,6 +58,7 @@ See https://github.com/scylladb/sphinx-scylladb-theme/pull/891 The following properties can be defined on a per-version basis. * `rst_prolog` +* `myst_substitutions`: Introduced in 0.3.3 * `exclude_patterns`: Introduced in 0.3.2 ## License diff --git a/extensions/sphinx-multiversion/setup.py b/extensions/sphinx-multiversion/setup.py index ace924141..460b86997 100644 --- a/extensions/sphinx-multiversion/setup.py +++ b/extensions/sphinx-multiversion/setup.py @@ -21,7 +21,7 @@ author="Jan Holthuis", author_email="holthuis.jan@googlemail.com", url="https://holzhaus.github.io/sphinx-multiversion/", - version="0.3.2", + version="0.3.3", install_requires=["sphinx >= 2.1"], license="BSD", packages=["sphinx_multiversion"], diff --git a/extensions/sphinx-multiversion/sphinx_multiversion/__init__.py b/extensions/sphinx-multiversion/sphinx_multiversion/__init__.py index 8d026a392..ce7415900 100644 --- a/extensions/sphinx-multiversion/sphinx_multiversion/__init__.py +++ b/extensions/sphinx-multiversion/sphinx_multiversion/__init__.py @@ -2,7 +2,7 @@ from .main import main from .sphinx import setup -__version__ = "0.3.1" +__version__ = "0.3.3" __all__ = [ "setup", diff --git a/extensions/sphinx-multiversion/sphinx_multiversion/main.py b/extensions/sphinx-multiversion/sphinx_multiversion/main.py index 7888c2f80..c9ace2aff 100644 --- a/extensions/sphinx-multiversion/sphinx_multiversion/main.py +++ b/extensions/sphinx-multiversion/sphinx_multiversion/main.py @@ -308,11 +308,15 @@ def main(argv=None): current_sourcedir = os.path.join(repopath, sourcedir) project = sphinx_project.Project(current_sourcedir, source_suffixes) + + myst_substitutions = getattr(current_config, 'myst_substitutions', {}) + metadata[gitref.name] = { "name": gitref.name, "version": current_config.version, "release": current_config.release, "rst_prolog": current_config.rst_prolog, + "myst_substitutions": myst_substitutions, "exclude_patterns": current_config.exclude_patterns, "is_released": bool( re.match(config.smv_released_pattern, gitref.refname) diff --git a/extensions/sphinx-multiversion/sphinx_multiversion/sphinx.py b/extensions/sphinx-multiversion/sphinx_multiversion/sphinx.py index 75e560ae8..70b7fbe0c 100644 --- a/extensions/sphinx-multiversion/sphinx_multiversion/sphinx.py +++ b/extensions/sphinx-multiversion/sphinx_multiversion/sphinx.py @@ -181,6 +181,7 @@ def config_inited(app, config): config.version = data["version"] config.release = data["release"] config.rst_prolog = data["rst_prolog"] + config.myst_substitutions = data["myst_substitutions"] config.exclude_patterns = data["exclude_patterns"] config.today = old_config.today if not config.today: diff --git a/sphinx_scylladb_theme/extensions/hero_box.py b/sphinx_scylladb_theme/extensions/hero_box.py index 29fac2aa4..a5db78b98 100644 --- a/sphinx_scylladb_theme/extensions/hero_box.py +++ b/sphinx_scylladb_theme/extensions/hero_box.py @@ -24,6 +24,7 @@ class HeroBox(Directive): "button_text": directives.path, "search_box": directives.flag, "content_page": directives.flag, + "ai_chatbot_id": directives.unchanged, } def run(self): @@ -88,18 +89,34 @@ def run(self): ) has_search_box = "search_box" in self.options - search_box = ( - generate_template( + + ai_chatbot_id = self.options.get("ai_chatbot_id") + + ask_ai_section = "" + if ai_chatbot_id: + ask_ai_section = """ +
+ Ask AI +
""".format(class_name=class_name, ai_chatbot_id=ai_chatbot_id) + + if has_search_box: + search_box = generate_template( """ - {% if theme_hide_ai_chatbot|lower != 'true' %} -