Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
sphinx
sphinx-rtd-theme
pydata-sphinx-theme
3 changes: 2 additions & 1 deletion docs/source/_ext/garak_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def run(self) -> list:
probe_ref = f":obj:`~garak.probes.{probe}`"
detector_ref = f":obj:`~garak.detectors.{detector}`"

rst += f"\n* {probe_ref}: {100*(1-scores["mu"]):.1f}% with detector {detector_ref}"
mu = 1 - scores["mu"]
rst += f"\n* {probe_ref}: {100*(mu):.1f}% with detector {detector_ref}"

if rst:
rst = (
Expand Down
40 changes: 40 additions & 0 deletions docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.reference,
.icon-home,
a:link,
a:visited,
a:hover,
a:active {
color: #76b900; /* nv */
}

.wy-menu-vertical li.toctree-l1.current>a,
li.toctree-l1.current>a:link,
li.toctree-l2.current>a:link,
.wy-menu-vertical li.toctree-l3.current>a>code,
.rst-content code.literal {
color: #76b900;
}

.btn-neutral:link,
.btn-neutral:visited,
.btn-neutral:hover,
.btn-neutral:active {
color: #76b900 !important;
}

html[data-theme=light], html[data-theme=dark]{
--pst-color-primary: #76b900;
--pst-color-secondary: #76b900; /* nv */
--pst-color-inline-code: #76b900;
--pst-color-inline-code-links: #76b900;
}

html[data-theme=light]{
--pst-color-info-bg: #E0E0E0;
--pst-color-info: #000000;
}

html[data-theme=dark]{
--pst-color-info-bg: #000000;
--pst-color-info: #E0E0E0;
}
12 changes: 12 additions & 0 deletions docs/source/_static/switcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

{
"name": "latest",
"version": "latest",
"url": "https://reference.garak.ai/en/latest/"
},
{
"name": "stable",
"version": "stable",
"url": "https://reference.garak.ai/en/stable/"
}
]
23 changes: 19 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
project = "garak"
copyright = f"2023-{datetime.datetime.now().year}, NVIDIA Corporation"
author = "Leon Derczynski"
version: str = 'latest' # required by the version switcher

# -- General configuration

Expand All @@ -16,29 +17,43 @@
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"garak_ext"
]

intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
}

intersphinx_disabled_domains = ["std"]

templates_path = ["_templates"]
exclude_patterns = []
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]

# -- Options for HTML output

html_theme = "sphinx_rtd_theme"
html_theme = "pydata_sphinx_theme"

html_theme_options = {
"navbar_start": ["navbar-logo", "version-switcher"],
"switcher": {
"json_url": "https://raw.githubusercontent.com/NVIDIA/garak/refs/heads/main/docs/source/_static/switcher.json",
"version_match": version
},
}

html_sidebars = {
"**": ["sidebar-nav-bs"],
}

# These folders are copied to the documentation's HTML output
html_static_path = ['_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
"css/garak_theme.css",
"css/custom.css",
]

# -- Options for EPUB output
Expand All @@ -48,4 +63,4 @@
import sys

sys.path.insert(0, "../..")
sys.path.append(os.path.abspath("./_ext"))
sys.path.append(os.path.abspath("./_ext"))
10 changes: 10 additions & 0 deletions docs/source/extending_and_contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Extending and Contributing
==========================

.. toctree::
:maxdepth: 1

extending
extending.generator
extending.probe
contributing
47 changes: 3 additions & 44 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,9 @@ Check out the :doc:`usage` section for further information, including :doc:`inst


.. toctree::
:caption: Using garak
:maxdepth: 1
:hidden:

how
install
usage
configurable
cliref
reporting
translation
ascii_smuggling
FAQ <https://github.com/NVIDIA/garak/blob/main/FAQ.md>
using_garak
reference
extending_and_contributing

.. toctree::
:caption: Reference
:maxdepth: 1
:hidden:

basic
attempt
buffs
cli
command
detectors
evaluators
exception
generators
harnesses
interactive
langservice
payloads
probes
report
_config
_plugins


.. toctree::
:caption: Extending and Contributing
:maxdepth: 1
:hidden:

extending
extending.generator
extending.probe
contributing
23 changes: 23 additions & 0 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Reference
=========

.. toctree::
:maxdepth: 1

basic
attempt
buffs
cli
command
detectors
evaluators
exception
generators
harnesses
interactive
langservice
payloads
probes
report
_config
_plugins
15 changes: 15 additions & 0 deletions docs/source/using_garak.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Using ``garak``
================

.. toctree::
:maxdepth: 1

how
install
usage
configurable
cliref
reporting
translation
ascii_smuggling
FAQ <https://github.com/NVIDIA/garak/blob/main/FAQ.md>
Loading