Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use modern material theme for docs #5035

Merged
merged 11 commits into from Aug 1, 2023

Conversation

lc0rp
Copy link
Contributor

@lc0rp lc0rp commented Jul 21, 2023

Background

We're using a ReadTheDocs theme that hasn't changed in years, and isn't the default, more modern MkDocs theme.

@RaghavKumar suggested the Material UI theme, and after using it, the docs feel way more accessible.

It's also the most popular MkDocs theme, by far, according to https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes.

Changes

  • Updated requirements.txt to include the mkdocs-material package
  • Changed theme in mkdocs.yaml
  • Configured some theme options like color schemes, navigation, etcetera
  • Added logo to docs/imgs (for favicon)

Documentation

N/A - these are the docs

Test Plan

Played around with it in-browser for the past 3h :-(

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes.
  • I have run the following commands against my code to ensure it passes our linters:
    black .
    isort .
    mypy
    autoflake --remove-all-unused-imports --recursive --ignore-init-module-imports --ignore-pass-after-docstring autogpt tests --in-place

Preview:

image image

@lc0rp lc0rp added the documentation Improvements or additions to documentation label Jul 21, 2023
@lc0rp lc0rp added this to the v0.4.6 Release milestone Jul 21, 2023
@netlify
Copy link

netlify bot commented Jul 21, 2023

Deploy Preview for auto-gpt-docs failed.

Name Link
🔨 Latest commit d699ef6
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/64c92fa8169cff0008e2bda9

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (fc62552) 51.95% compared to head (d699ef6) 51.95%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5035   +/-   ##
=======================================
  Coverage   51.95%   51.95%           
=======================================
  Files         116      116           
  Lines        4987     4987           
  Branches      671      671           
=======================================
  Hits         2591     2591           
  Misses       2198     2198           
  Partials      198      198           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mkdocs.yml Outdated Show resolved Hide resolved
@collijk
Copy link
Contributor

collijk commented Jul 21, 2023

I think this is a great idea. I love material. Some things from my own technical documentation projects.

In the theme you can add:

theme:
    name: material
    features:
      - content.code.copy

and that will enable the little click to copy box in code snippets for people looking at our docs.

I also just blanket put in

markdown_extensions:
  - abbr
  - admonition
  - attr_list
  - def_list
  - footnotes
  - md_in_html
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.critic
  - pymdownx.caret
  - pymdownx.details
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
  - pymdownx.highlight:
      anchor_linenums: true
      line_spans: __span
      pygments_lang_class: true
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.mark
  - pymdownx.snippets:
      auto_append:
        - includes/abbreviations.md
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde
  - tables
plugins:
  - table-reader
  - search
extra_javascript:
  - https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js
  - _javascript/tablesort.js
  - _javascript/mathjax.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

and add

window.MathJax = {
  tex: {
    inlineMath: [["\\(", "\\)"]],
    displayMath: [["\\[", "\\]"]],
    processEscapes: true,
    processEnvironments: true
  },
  options: {
    ignoreHtmlClass: ".*|",
    processHtmlClass: "arithmatex"
  }
};

document$.subscribe(() => {
  MathJax.typesetPromise()
})

to docs/_javascript/mathjax.js

and

document$.subscribe(function() {
  var tables = document.querySelectorAll("article table:not([class])")
  tables.forEach(function(table) {
    new Tablesort(table)
  })
})

to docs/_javascript/tablesort.js.

This set of stuff enables all the features in material (which are turned off by default).

@collijk
Copy link
Contributor

collijk commented Jul 21, 2023

Happy to let you decide what you want to include here, but would like to hear your thoughts.

Added search plugin

Co-authored-by: James Collins <collijk@uw.edu>
@lc0rp
Copy link
Contributor Author

lc0rp commented Jul 21, 2023

These are great! Testing them now...

@github-actions github-actions bot added size/l and removed size/m labels Jul 21, 2023
@lc0rp lc0rp requested a review from collijk July 22, 2023 02:54
@Pwuts
Copy link
Member

Pwuts commented Jul 27, 2023

It seems to be missing the extension that does highlighting for indented code blocks
image

ntindle
ntindle previously approved these changes Jul 28, 2023
Pwuts
Pwuts previously requested changes Jul 28, 2023
mkdocs.yml Show resolved Hide resolved
and codeblocks throughout the docs to align with mkdocs-material recommendations.

codehilite is deprecated in favor of the highlight extension:
https://squidfunk.github.io/mkdocs-material/setup/extensions/python-markdown-extensions/#highlight
@lc0rp lc0rp requested a review from Pwuts July 30, 2023 19:58
@lc0rp lc0rp modified the milestones: v0.4.6 Release, v0.4.7 Release Jul 30, 2023
@collijk collijk dismissed Pwuts’s stale review August 1, 2023 15:13

Changes have been addressed

@collijk collijk merged commit 7cd407b into Significant-Gravitas:master Aug 1, 2023
11 of 16 checks passed
@lc0rp lc0rp deleted the material-theme-docs branch August 2, 2023 08:13
@vittorio88
Copy link
Contributor

@lc0rp @collijk I made a small correction to a sample YAML snippet that came from this PR. Would appreciate a review, thank you.
The PR is #5168 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation size/l
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

6 participants