# Book settings
# Learn more at https://jupyterbook.org/customize/config.html

#######################################################################################
# A default configuration that will be loaded for all jupyter books
# Users are expected to override these values in their own `_config.yml` file.
# This is also the "master list" of all allowed keys and values.

#######################################################################################
# Book settings
title                       : Serena Documentation  # The title of the book. Will be placed in the left navbar.
author                      : Oraios AI & Oraios Software  # The author of the book
copyright                   : "2025 by Serena contributors"  # Copyright year to be placed in the footer
# Patterns to skip when building the book. Can be glob-style (e.g. "*skip.ipynb")
exclude_patterns            : ['**.ipynb_checkpoints', '.DS_Store', 'Thumbs.db', '_build', 'jupyter_execute', '.jupyter_cache', '.pytest_cache', 'docs/autogen_docs.py', 'docs/create_toc.py']
# Auto-exclude files not in the toc
only_build_toc_files        : true

#######################################################################################
# Execution settings
execute:
  # NOTE: Notebooks are not executed, because test_notebooks.py executes them and stores them with outputs in the docs/ folder
  # NOTE: If changed, repeat below in `nb_execution_mode`.
  execute_notebooks         : "off"  # Whether to execute notebooks at build time. Must be one of ("auto", "force", "cache", "off")
  cache                     : ""    # A path to the jupyter cache that will be used to store execution artifacts. Defaults to `_build/.jupyter_cache/`
  exclude_patterns          : []    # A list of patterns to *skip* in execution (e.g. a notebook that takes a really long time)
  timeout                   : 1000    # The maximum time (in seconds) each notebook cell is allowed to run.
  run_in_temp               : false # If `True`, then a temporary directory will be created and used as the command working directory (cwd),
                                    # otherwise the notebook's parent directory will be the cwd.
  allow_errors              : true # If `False`, when a code cell raises an error the execution is stopped, otherwise all cells are always run.
  stderr_output             : show  # One of 'show', 'remove', 'remove-warn', 'warn', 'error', 'severe'

#######################################################################################
# Parse and render settings
parse:
  myst_enable_extensions: # default extensions to enable in the myst parser. See https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html
    - amsmath
    - colon_fence
    # - deflist
    - dollarmath
    # - html_admonition
    # - html_image
    - linkify
    # - replacements
    # - smartquotes
    - substitution
    - tasklist
    - html_admonition
    - html_image
  myst_url_schemes: [ mailto, http, https ] # URI schemes that will be recognised as external URLs in Markdown links
  myst_dmath_double_inline: true  # Allow display math ($$) within an inline context

#######################################################################################
# HTML-specific settings
html:
  favicon                   : "../src/serena/resources/dashboard/serena-icon-32.png"
  use_edit_page_button      : false  # Whether to add an "edit this page" button to pages. If `true`, repository information in repository: must be filled in
  use_repository_button     : false  # Whether to add a link to your repository button
  use_issues_button         : false  # Whether to add an "open an issue" button
  use_multitoc_numbering    : true   # Continuous numbering across parts/chapters
  use_darkmode_button       : false
  extra_footer              : ""
  home_page_in_navbar       : true  # Whether to include your home page in the left Navigation Bar
  baseurl                   : "https://oraios.github.io/serena/"
  comments:
    hypothesis              : false
    utterances              : false
  announcement              : "" # A banner announcement at the top of the site.

#######################################################################################
# LaTeX-specific settings
latex:
  latex_engine              : pdflatex  # one of 'pdflatex', 'xelatex' (recommended for unicode), 'luatex', 'platex', 'uplatex'
  use_jupyterbook_latex     : true # use sphinx-jupyterbook-latex for pdf builds as default
  targetname                : book.tex
# Add a bibtex file so that we can create citations
#bibtex_bibfiles:
#  - refs.bib

#######################################################################################
# Launch button settings
launch_buttons:
  notebook_interface        : classic  # The interface interactive links will activate ["classic", "jupyterlab"]
  binderhub_url             : ""  # The URL of the BinderHub (e.g., https://mybinder.org)
  jupyterhub_url            : ""  # The URL of the JupyterHub (e.g., https://datahub.berkeley.edu)
  thebe                     : false  # Add a thebe button to pages (requires the repository to run on Binder)
  colab_url                 : "https://colab.research.google.com"

repository:
  url                       : https://github.com/oraios/serena  # The URL to your book's repository
  path_to_book              : docs  # A path to your book's folder, relative to the repository root.
  branch                    : main  # Which branch of the repository should be used when creating links

#######################################################################################
# Advanced and power-user settings
sphinx:
  extra_extensions          :
    - sphinx.ext.autodoc
    - sphinx.ext.viewcode
    - sphinx_toolbox.more_autodoc.sourcelink
    #- sphinxcontrib.spelling
  local_extensions          :   # A list of local extensions to load by sphinx specified by "name: path" items
  recursive_update          : false # A boolean indicating whether to overwrite the Sphinx config (true) or recursively update (false)
  config                    :   # key-value pairs to directly over-ride the Sphinx configuration
    master_doc: "01-about/000_intro.md"
    html_theme_options:
      logo:
        image_light: ../resources/serena-logo.svg
        image_dark: ../resources/serena-logo-dark-mode.svg
    autodoc_typehints_format: "short"
    autodoc_member_order: "bysource"
    autoclass_content: "both"
    autodoc_default_options:
      show-inheritance: True
    autodoc_show_sourcelink: True
    add_module_names: False
    github_username: oraios
    github_repository: serena
    nb_execution_mode: "off"
    nb_merge_streams: True  # This is important for cell outputs to appear as single blocks rather than one block per line
    python_use_unqualified_type_names: True
    nb_mime_priority_overrides: [
      [ 'html', 'application/vnd.jupyter.widget-view+json', 10 ],
      [ 'html', 'application/javascript', 20 ],
      [ 'html', 'text/html', 30 ],
      [ 'html', 'text/latex', 40 ],
      [ 'html', 'image/svg+xml', 50 ],
      [ 'html', 'image/png', 60 ],
      [ 'html', 'image/jpeg', 70 ],
      [ 'html', 'text/markdown', 80 ],
      [ 'html', 'text/plain', 90 ],
      [ 'spelling', 'application/vnd.jupyter.widget-view+json', 10 ],
      [ 'spelling', 'application/javascript', 20 ],
      [ 'spelling', 'text/html', 30 ],
      [ 'spelling', 'text/latex', 40 ],
      [ 'spelling', 'image/svg+xml', 50 ],
      [ 'spelling', 'image/png', 60 ],
      [ 'spelling', 'image/jpeg', 70 ],
      [ 'spelling', 'text/markdown', 80 ],
      [ 'spelling', 'text/plain', 90 ],
    ]
    mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
    mathjax3_config:
      loader: { load: [ '[tex]/configmacros' ] }
      tex:
        packages: { '[+]': [ 'configmacros' ] }
        macros:
          vect: ["{\\mathbf{\\boldsymbol{#1}} }", 1]
          E: "{\\mathbb{E}}"
          P: "{\\mathbb{P}}"
          R: "{\\mathbb{R}}"
          abs: ["{\\left| #1 \\right|}", 1]
          simpl: ["{\\Delta^{#1} }", 1]
          amax: "{\\text{argmax}}"
