Contributing¶
First off, thanks for wanting to contribute to the Spaced Repetition plugin!
Bug Reports & Feature Requests¶
- Check the roadmap for upcoming features & fixes.
- Raise an issue here if you have a feature request or a bug report.
- Visit the discussions section for Q&A help, feedback, and general discussion.
Translating¶
The plugin has been translated into the following languages by the Obsidian community 😄.
- Arabic / العربية
- Chinese (Simplified) / 简体中文
- Chinese (Traditional) / 繁體中文
- Czech / čeština
- French / français
- German / Deutsch
- Italian / Italiano
- Korean / 한국어
- Japanese / 日本語
- Polish / Polski
- Portuguese (Brazil) / Português do Brasil
- Spanish / Español
- Russian / русский
- Turkish / Türkçe
Steps¶
To help translate the plugin to your language:
- Fork the repository.
- Copy the entries from
src/lang/locale/en.ts
to the proper file insrc/lang/locale/
(i.e.fr.ts
for French, orsw.ts
for Swahili). The locale codes are IETF language tags. - Translate,
- Then open a pull request,
Example¶
Sample en.ts
file:
// English
export default {
EASY: "Easy",
SHOW_ANSWER: "Show Answer",
DAYS_STR_IVL: "${interval} days",
CHECK_ALGORITHM_WIKI:
'For more information, check the <a href="${algoUrl}">algorithm implementation</a>.',
};
Equivalent sw.ts
file:
// Swahili
export default {
EASY: "Rahisi",
SHOW_ANSWER: "Onyesha Jibu",
DAYS_STR_IVL: "Siku ${interval}",
CHECK_ALGORITHM_WIKI:
'Kwa habari zaidi, angalia <a href="${algoUrl}">utekelezaji wa algorithm</a>.',
};
A part of that last one is uhh, Google translated, I have a working understanding of Swahili but not enough to write computerese lol.
Please note that:
- Only the strings(templates) on the right of the key should be translated.
- Text inside
${}
isn't translated. This is used to replace variables in code. For instance, if interval = 4, it becomes4 days
in English &Siku 4
in Swahili. Quite nifty if you ask me.
Code¶
- Make your changes.
- Run
pnpm dev
to watch for changes & rebuild the plugin automatically. -
You could create symbolic links between the build files and the Obsidian vault, example:
# remove existing files in the Obsidian vault rm ~/notes/.obsidian/plugins/obsidian-spaced-repetition/main.js ~/notes/.obsidian/plugins/obsidian-spaced-repetition/manifest.json ~/notes/.obsidian/plugins/obsidian-spaced-repetition/styles.css # use absolute paths ln -s /home/stephen/obsidian-spaced-repetition/build/main.js /home/stephen/notes/.obsidian/plugins/obsidian-spaced-repetition ln -s /home/stephen/obsidian-spaced-repetition/manifest.json /home/stephen/notes/.obsidian/plugins/obsidian-spaced-repetition ln -s /home/stephen/obsidian-spaced-repetition/styles.css /home/stephen/notes/.obsidian/plugins/obsidian-spaced-repetition
- This can be coupled with the Hot Reload plugin
-
Document the "user-facing" changes e.g. new feature, UI change, etc.
- If your "business logic" is properly decoupled from Obsidian APIs, write some unit tests.
- This project uses jest, tests are stored in
tests/
. pnpm test
- This project uses jest, tests are stored in
- Before pushing your changes, run the linter:
pnpm lint
- Format the code in case any warnings are raised:
pnpm format
- Format the code in case any warnings are raised:
- Open the pull request.
Documentation¶
The documentation consists of Markdown files which MkDocs converts to static web pages. Specifically, this project uses MkDocs Material.
These files reside in docs/docs/
in the respective language's folder. For instance, English docs are located in docs/docs/en/
.
The docs are served on https://www.stephenmwangi.com/obsidian-spaced-repetition/.
For small changes, you can simply open an pull request for merging (against the master
branch).
The changes will be live once a new release is made.
For larger diffs, it's important that you check how your docs look like as explained below.
Viewing Docs Locally¶
Initial Setup¶
- Create a virtual environment:
python3 -m venv venv
- Activate it:
. venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
Viewing¶
- Activate the virtual environment:
. venv/bin/activate
- Serve the docs:
mkdocs serve
- View your documentation locally on http://127.0.0.1:8000/obsidian-spaced-repetition/, any changes you make will reflect on the browser instantly.
Translating Documentation¶
- Create a folder for your language in
docs/docs/
if it doesn't exist. Use the language codes provided here. - Add the code from (1) to the MkDocs configuration (
mkdocs.yml
-plugins.i18n.languages
). - Copy the files from the English (
en
) folder into the new folder. - Translate then open a pull request.
Maintenance¶
Releases¶
Example using v1.9.2
:
- Create a new branch:
git switch -c release-v1.9.2
- Bump the plugin version in
manifest.json
andpackage.json
(following Semantic Versioning).- Semantic Versioning TL;DR, given a version number
MAJOR.MINOR.PATCH
, increment the:MAJOR
version when you make incompatible API changesMINOR
version when you add functionality in a backwards compatible mannerPATCH
version when you make backwards compatible bug fixes
- If the new version uses new Obsidian APIs, update
minAppVersion
andversions.json
to reflect this.
- Semantic Versioning TL;DR, given a version number
- Run
pnpm changelog
to update the CHANGELOG. -
Commit and push the changes:
-
Open and merge the PR into
master
. - Locally, switch back to
master
and pull the changes:git switch master && git pull
- Create a git tag with the version:
git tag -a 1.9.2 -m "1.9.2"
- Push the tag:
git push --tags
.
You're all set! This GitHub action should pick it up, create a release, publish it, and update the live documentation.