mirror of
https://github.com/ankitects/anki.git
synced 2026-07-28 11:29:00 -04:00
## Summary - add a generated `docs-site/` Mintlify proof of concept for a unified Anki docs site - migrate the desktop manual, AnkiMobile docs, FAQs, add-on docs, translation docs, release notes, legacy docs, and repo-local Sphinx/MyST developer docs into the POC tree - add a migration helper that preserves mdBook ordering, handles common MDX incompatibilities, and regenerates the landing-page-inspired Mintlify styling - apply minimal styling based on the current Anki landing page: Anki logo, Hanken Grotesk, blue primary color, subtle surfaces, and compact nav treatment ## Validation - `uv run --with ty ty check tools/mintlify_poc_migrate.py` - `source ~/.nvm/nvm.sh && nvm use 22.15.0 && mint validate` - previewed locally with `mint dev --port 3000` and checked the home page/developer docs in browser ## Notes This is intentionally a draft POC. It does not remove the existing Sphinx or mdBook docs flows yet; it demonstrates what bringing the sources into this repo and building from a single Mintlify root could look like. --------- Co-authored-by: Andrew Sanchez <andrewsanchez@users.noreply.github.com> Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com> Co-authored-by: Abdo <abdo@abdnh.net>
38 lines
1.1 KiB
Plaintext
38 lines
1.1 KiB
Plaintext
---
|
|
title: "A Basic Add-on"
|
|
---
|
|
|
|
Add the following to `myaddon/__init__.py` in your add-ons folder:
|
|
|
|
```python
|
|
# import the main window object (mw) from aqt
|
|
from aqt import mw
|
|
# import the "show info" tool from utils.py
|
|
from aqt.utils import showInfo, qconnect
|
|
# import all of the Qt GUI library
|
|
from aqt.qt import *
|
|
|
|
# We're going to add a menu item below. First we want to create a function to
|
|
# be called when the menu item is activated.
|
|
|
|
def testFunction() -> None:
|
|
# get the number of cards in the current collection, which is stored in
|
|
# the main window
|
|
cardCount = mw.col.card_count()
|
|
# show a message box
|
|
showInfo("Card count: %d" % cardCount)
|
|
|
|
# create a new menu item, "test"
|
|
action = QAction("test", mw)
|
|
# set it to call testFunction when it's clicked
|
|
qconnect(action.triggered, testFunction)
|
|
# and add it to the tools menu
|
|
mw.form.menuTools.addAction(action)
|
|
```
|
|
|
|
Restart Anki, and you should find a 'test' item in the tools menu.
|
|
Running it will display a dialog with the card count.
|
|
|
|
If you make a mistake when entering in the plugin, Anki will show an
|
|
error message on startup indicating where the problem is.
|