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

[DEV]: Option to send developer logging to file instead of console.log #1042

Draft
wants to merge 118 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
0b5f775
Initial fix, added much debug output
ronzulu Dec 29, 2023
1887bbc
Removed debug code
ronzulu Dec 30, 2023
1ea94ea
Reverted some variable name changes etc
ronzulu Dec 30, 2023
00b53b9
Fixed incorrect condition identified by https://github.com/karimodm
ronzulu Jan 1, 2024
4ada044
Merge remote-tracking branch 'upstream/master' into bug-424-auto-revi…
ronzulu Jan 2, 2024
b17c300
Updated change log, npx prettier
ronzulu Jan 2, 2024
0a5847a
Updated code and language files
ronzulu Jan 12, 2024
92b6cef
pnpm format & lint
ronzulu Jan 12, 2024
3dec603
Partial implementation
ronzulu Jan 14, 2024
36b8531
Merge remote-tracking branch 'upstream/master' into bug-424-auto-revi…
ronzulu Jan 15, 2024
3134bba
Merge branch 'bug-670-label-customisation'
ronzulu Jan 15, 2024
027f82a
Progressed implementation
ronzulu Jan 17, 2024
235c9cf
Alternative to needing the "Advanced" tab
ronzulu Jan 18, 2024
96e6d2a
Perhaps half way towards implementation; doesn't build yet
ronzulu Feb 19, 2024
14cc9c8
Implemented 70%; doesn't build
ronzulu Feb 21, 2024
4c14127
Progress
ronzulu Feb 21, 2024
614c4f2
Progress
ronzulu Feb 22, 2024
f40967f
Progress
ronzulu Feb 22, 2024
2db8cf0
11 of the 19 existing test suites pass
ronzulu Feb 23, 2024
10d55a0
12 of the 19 existing test suites pass
ronzulu Feb 23, 2024
1242a29
14 of the 19 existing test suites pass
ronzulu Feb 24, 2024
a54ffaf
Progress
ronzulu Feb 24, 2024
335ba58
15 of the 19 existing test suites pass
ronzulu Feb 24, 2024
8977647
All nineteen existing test suites pass
ronzulu Feb 25, 2024
4be2553
Minor fixes
ronzulu Feb 28, 2024
381d119
More refactoring; doesn't build
ronzulu Feb 28, 2024
778985e
Progress, doesn't build
ronzulu Feb 29, 2024
4b8540c
Builds and all existing unit tests pass
ronzulu Feb 29, 2024
f181a7b
Progress
ronzulu Mar 3, 2024
b6bd619
Merge remote-tracking branch 'upstream/master'
ronzulu Mar 10, 2024
6aff45a
Merge remote-tracking branch 'upstream/master' into feat-878-support-…
ronzulu Mar 11, 2024
5f85b46
Merge remote-tracking branch 'upstream/master'; due to conflicts fair…
ronzulu Mar 11, 2024
37f7085
Merge remote-tracking branch 'upstream/master' into feat-878-support-…
ronzulu Mar 11, 2024
a914204
Merge remote-tracking branch 'upstream/master'
ronzulu Mar 11, 2024
ccf0b67
Continued fixing post #495 integration
ronzulu Mar 12, 2024
3a86db9
Added some test cases for OsrCore
ronzulu Mar 13, 2024
447fcc1
Added unit test support code
ronzulu Mar 16, 2024
3bf2034
Added more test files
ronzulu Mar 20, 2024
dab4e1e
Merge remote-tracking branch 'upstream/master'
ronzulu Mar 22, 2024
41f0a78
Merge remote-tracking branch 'upstream/master'
ronzulu Mar 28, 2024
61c52f9
Added test case, fixed code issues
ronzulu May 2, 2024
abfe2b3
Updated tests
ronzulu May 8, 2024
f104cee
Small refactor
ronzulu May 8, 2024
ca85290
!!GitHub_Desktop<feat-878-support-multiple-schedule-methods>
ronzulu May 8, 2024
ce1640c
Fixes post merge stash
ronzulu May 8, 2024
8d7d9c1
Added tests
ronzulu May 9, 2024
8e1c20b
More refactoring
ronzulu May 20, 2024
a2fa8d1
Improved test coverage
ronzulu May 21, 2024
d2d9c5e
Improved unit test code coverage
ronzulu May 22, 2024
4e80ed5
Use obsidians funtion to extractFrontmatter
4Source May 23, 2024
d825c31
Fix line pos shift
4Source May 23, 2024
d71c7ae
Merge branch 'st3v3nmw:master' into bug_967
4Source May 24, 2024
8d79dcd
Stop using obsidian function because of UnitTest
4Source May 24, 2024
0b4ac9e
Add UnitTest for Frontmatter and Horizontal line
4Source May 24, 2024
0d27150
Fix linting
4Source May 24, 2024
6487b49
Starting testing of plugin within Obsidian
ronzulu Jun 1, 2024
2a571c7
Bug fixes
ronzulu Jun 1, 2024
27fbc55
add translation: zh-cn
artefaritaKuniklo Jun 4, 2024
07d8a2d
FEAT-990 Mobile landscape mode and functional size sliders
annappropriate Jun 16, 2024
d162d56
Merge remote-tracking branch 'upstream/master' into feat-839-split-op…
ronzulu Jun 20, 2024
81a9494
Fixed broken test cases
ronzulu Jun 22, 2024
b4e6a4c
Added test case for global coverage
ronzulu Jun 22, 2024
6503dc9
fix #1000 sidebar indent
Newdea Jun 22, 2024
3e8ee76
Merge remote-tracking branch 'upstream/master' into feat-878-support-…
ronzulu Jun 23, 2024
9adfecc
A few merge fixes
ronzulu Jun 23, 2024
9d1c298
Version ready for beta testing
ronzulu Jun 25, 2024
66ec28b
Format and lint
ronzulu Jun 25, 2024
aeef00e
Updated actions/checkout@v3 to node 20
ronzulu Jun 25, 2024
e75c4b6
Lets make lint happy!
ronzulu Jun 25, 2024
05c0806
Previously the pnpm format added a blank line in a test markdown file…
ronzulu Jun 25, 2024
237209f
Slightly reduced jest code coverage threshold to writing a number of …
ronzulu Jun 26, 2024
ec9b4af
Merge remote-tracking branch 'upstream/master'
ronzulu Jun 27, 2024
0f7e21a
Create manifest-beta.json
ronzulu Jun 27, 2024
247104e
Node version 20
ronzulu Jun 27, 2024
e2727b8
Release
ronzulu Jun 27, 2024
51ae4e8
Update
ronzulu Jun 28, 2024
cc51c7d
Update
ronzulu Jul 1, 2024
2a6fc62
Update
ronzulu Jul 1, 2024
20ee92d
Update
ronzulu Jul 1, 2024
0b54b70
Update
ronzulu Jul 1, 2024
00e6c47
Update
ronzulu Jul 1, 2024
28963a8
Update
ronzulu Jul 1, 2024
57a4656
Squashed commit of the following:
ronzulu Jul 1, 2024
f3f6819
Merged #335
ronzulu Jul 1, 2024
ed061a1
Merge remote-tracking branch 'osrr/fix/sidebarIndent'
ronzulu Jul 3, 2024
8ceb3da
Update
ronzulu Jul 3, 2024
712ec01
Update
ronzulu Jul 3, 2024
2497bb6
Merge remote-tracking branch 'artefaritaKuniklo/master' https://githu…
ronzulu Jul 3, 2024
6296a75
Merge remote-tracking branch 'annappropriate/feat-990-mobile-css-full…
ronzulu Jul 3, 2024
15f5fb7
Update
ronzulu Jul 3, 2024
8d3310f
Merge branch 'feat-878-support-multiple-schedule-methods' https://git…
ronzulu Jul 4, 2024
e1d7066
Fixed bug where note frontmatter interval/ease set to null (app speci…
ronzulu Jul 4, 2024
4371e4a
Merge branch 'feat-878-support-multiple-schedule-methods' (post bug fix)
ronzulu Jul 4, 2024
c533ea7
Merge remote-tracking branch '4source/bug_967'
ronzulu Jul 4, 2024
ef42f50
Squashed commit of the following:
ronzulu Jul 4, 2024
c424225
Update changelog.md
ronzulu Jul 4, 2024
0f50c66
Fixed some note review queue bugs (previously introduced in branch #878)
ronzulu Jul 9, 2024
ed2c831
Merge branch 'feat-878-support-multiple-schedule-methods'
ronzulu Jul 9, 2024
22e8ca1
(1) Squashed commit of the following: https://github.com/st3v3nmw/obs…
ronzulu Jul 10, 2024
c3bc74b
Minor fix
ronzulu Jul 10, 2024
438365b
[FIX] Folder ignore sorts all folder starting with string
ronzulu Jul 16, 2024
938bd97
Fixed bug preventing card stats being shown (previously introduced in…
ronzulu Jul 16, 2024
a770393
[FIX] Not scroll back to top after review
ronzulu Jul 16, 2024
f6bb04f
Version number
ronzulu Jul 16, 2024
965c394
Added missing css
ronzulu Jul 19, 2024
82b94e0
Squashed commit of the following: https://github.com/st3v3nmw/obsidia…
ronzulu Jul 19, 2024
d056c0d
Updated messages for non-English languages
ronzulu Jul 19, 2024
c0119b1
Format & lint
ronzulu Jul 19, 2024
0bc337e
Merge branch 'feat-839-split-options-into-tabs' (format & lint)
ronzulu Jul 19, 2024
70b06c3
changelog update
ronzulu Jul 19, 2024
d56c41f
changelog.md
ronzulu Jul 19, 2024
cdb8abe
Merge branch 'feat-839-split-options-into-tabs' (change log)
ronzulu Jul 19, 2024
fd2e75d
Implementation
ronzulu Aug 5, 2024
26934d1
Added new text to non-English resources
ronzulu Aug 5, 2024
36ca05d
Format & lint
ronzulu Aug 5, 2024
56ac26a
Update error handling for sync()
ronzulu Aug 6, 2024
eabdc3c
path.dirname not present on some mobiles
ronzulu Aug 6, 2024
dd14089
Minor
ronzulu Aug 6, 2024
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ build
# testing
coverage
tests/e2e/vault/
tests/vaults/*/.obsidian

# mkdocs
site/
Expand Down
14 changes: 14 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [Unreleased]

- Support RTL flashcards specified by frontmatter "direction" attribute https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/935
- add translation: zh-cn https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/982
- Fix/sidebarIndent https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/1001
- FEAT-990 Mobile landscape mode + fully functional resize sliders https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/998
- Feat 878 Refactor code to support diff methods of storing the scheduling info, and diff SR algorithms https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/1006
- [FIX] Cards missing when horizontal rule present in document https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/970
- [FIX] Include link parsing for Review context https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/964
- Fixed notes selection when all notes are reviewed. [`#548`](https://github.com/st3v3nmw/obsidian-spaced-repetition/issues/548)
- [FIX] Folder ignore sorts all folder starting with string https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/972
- [FIX] Not scroll back to top after review https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/971
- [FEAT] Split the long list of options into categories within a tab control https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/1021

#### [1.12.4](https://github.com/st3v3nmw/obsidian-spaced-repetition/compare/1.12.3...1.12.4)

- chore: fix package manager issue in CI [`#939`](https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/939)
Expand Down
18 changes: 18 additions & 0 deletions docs/en/flashcards.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,24 @@ The plugin will automatically search for folders that contain flashcards & use t

This is an alternative to the tagging option and can be enabled in settings.

## RTL Support

There are two ways that the plugin can be used with RTL languages, such as Arabic, Hebrew, Persian (Farsi).

If all cards are in a RTL language, then simply enable the global Obsidian option `Editor → Right-to-left (RTL)`.

If all cards within a single note have the same LTR/RTL direction, then frontmatter can be used to specify the text direction. For example:

```
---
direction: rtl
---
```

This is the same way text direction is specified to the `RTL Support` plugin.

Note that there is no current support for cards with different text directions within the same note.

## Reviewing

Once done creating cards, click on the flashcards button on the left ribbon to start reviewing the flashcards. After a card is reviewed, a HTML comment is added containing the next review day, the interval, and the card's ease.
Expand Down
30 changes: 30 additions & 0 deletions docs/zh/algorithms.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 算法

## SM-2

!!! 警告

该条目长时间未更新,
请注意阅读 [源代码](https://github.com/st3v3nmw/obsidian-spaced-repetition/blob/master/src/scheduling.ts).

(除 PageRanks 之外,卡片复习采用相同规划算法)

- 该算法为 [Anki](https://faqs.ankiweb.net/what-spaced-repetition-algorithm.html) 所采用的基于 [SM-2 算法](https://www.supermemo.com/en/archives1990-2015/english/ol/sm2) 的变种。
- 使用三级打分制,即在复习阶段自评对某个概念的掌握程度为`困难`,`记得`或`简单`。
- 初始熟练度会根据链接笔记的平均熟练度、当前笔记的重要性和基本熟练度进行加权(使用 最大外链因子)。
- `当存在外链时: 初始熟练度 = (1 - 链接加权) * 基础熟练度 + 链接加权 * 外链平均熟练度`
- `链接加权 = 最大外链因子 * min(1.0, log(外链数目 + 0.5) / log(64))` (以自适应不同情况)
- 不同概念/笔记的优先级由 PageRank 算法设定(笔记之间存在轻重缓急)
- 大多数情况下基础概念/笔记具有更高优先级
- 当用户对某个概念/笔记的自评为:
- 简单, 熟练度增加 `20` 复习间隔更新为 `原复习间隔 * 更新后熟练度 / 100 * 1.3` (1.3 是简单奖励)
- 记得, 熟练度不变,复习间隔更新为 `原复习间隔 * old_ease / 100`
- 困难, 熟练度降低 `20`,复习间隔更新为 `原复习间隔 * 0.5`
- `0.5` 可在设置中更改
- `最小熟练度 = 130`
- 当复习间隔不小于 `8` 天时
- `间隔 += 随机取值({-扰动, 0, +扰动})`
- 设定 `扰动 = 向上取整(0.05 * 间隔)`
- [Anki 文档](https://faqs.ankiweb.net/what-spaced-repetition-algorithm.html):
> "[...] Anki 还会加入少量的随机扰动,以防止同时出现且评级相同的卡片获得相同的复习周期,导致其它们是在同一天被复习。"
- 复习规划信息将被存储于笔记的yaml front matter部分
156 changes: 156 additions & 0 deletions docs/zh/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Contributing

First off, thanks for wanting to contribute to the Spaced Repetition plugin!

## Bug Reports & Feature Requests

- Check the [roadmap](https://github.com/st3v3nmw/obsidian-spaced-repetition/projects/2/) for upcoming features & fixes.
- Raise an issue [here](https://github.com/st3v3nmw/obsidian-spaced-repetition/issues/) if you have a feature request or a bug report.
- Visit the [discussions](https://github.com/st3v3nmw/obsidian-spaced-repetition/discussions/) section for Q&A help, feedback, and general discussion.

## Translating

### Steps

To help translate the plugin to your language:

1. Fork the [repository](https://github.com/st3v3nmw/obsidian-spaced-repetition).
2. Copy the entries from `src/lang/locale/en.ts` to the proper file in `src/lang/locale/` (i.e. `fr.ts` for French, or `sw.ts` for Swahili). The locale codes are [IETF language tags](https://en.wikipedia.org/wiki/IETF_language_tag).
3. Translate,
4. Then open a pull request,

### Example

Sample `en.ts` file:

```typescript
// English

export default {
EASY: "Easy",
SHOW_ANSWER: "Show Answer",
DAYS_STR_IVL: "${interval} days",
CHECK_ALGORITHM_WIKI:
'For more information, check the <a href="${algo_url}">algorithm implementation</a>.',
};
```

Equivalent `sw.ts` file:

```typescript
// Swahili

export default {
EASY: "Rahisi",
SHOW_ANSWER: "Onyesha Jibu",
DAYS_STR_IVL: "Siku ${interval}",
CHECK_ALGORITHM_WIKI:
'Kwa habari zaidi, angalia <a href="${algo_url}">utekelezaji wa algorithm</a>.',
};
```

<sub><sup>A part of that last one is uhh, Google translated, I have a working understanding of Swahili but not enough to write computerese lol.</sup></sub>

Please note that:

1. Only the strings(templates) on the right of the key should be translated.
2. Text inside `${}` isn't translated. This is used to replace variables in code. For instance, if interval = 4, it becomes `4 days` in English & `Siku 4` in Swahili. Quite nifty if you ask me.

## Code

1. Make your changes.
2. Run `pnpm dev` to test the changes inside Obsidian.
3. You could create symbolic links between the build files and the Obsidian vault, example:

```bash
# 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](https://github.com/pjeby/hot-reload)

4. Document the "user-facing" changes e.g. new feature, UI change, etc.
5. If your "business logic" is properly decoupled from Obsidian APIs, write some unit tests.
- This project uses [jest](https://jestjs.io/), tests are stored in `tests/`.
- `pnpm test`
6. Add your change to the `[Unreleased]` section of the changelog (`docs/changelog.md`).
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), TL;DR:
- `Added` for new features.
- `Changed` for changes in existing functionality.
- `Deprecated` for soon-to-be removed features.
- `Removed` for now removed features.
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.
- You can also append a link to your GitHub profile, example:
- `Make flashcard text selectable [@st3v3nmw](https://github.com/st3v3nmw)`
7. Before pushing your changes, run the linter: `pnpm lint`
- Format the code in case any warnings are raised: `pnpm format`
8. Open the pull request.

## Documentation

The documentation consists of Markdown files which [MkDocs](https://www.mkdocs.org/) converts to static web pages.
Specifically, this project uses [MkDocs Material](https://squidfunk.github.io/mkdocs-material/getting-started/).

These files reside in `docs/` in the respective language's folder. For instance, English docs are located in `docs/en/`.

The docs are served on [https://www.stephenmwangi.com/obsidian-spaced-repetition/](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](https://github.com/st3v3nmw/obsidian-spaced-repetition/releases) is made.

For larger diffs, it's important that you check how your docs look like as explained below.

### Viewing Docs Locally

#### Initial Setup

1. Create a virtual environment: `python3 -m venv venv`
2. Activate it: `. venv/bin/activate`
3. Install the required dependencies: `pip install -r requirements.txt`

#### Viewing

1. Activate the virtual environment: `. venv/bin/activate`
2. Serve the docs: `mkdocs serve`
3. View your documentation locally on [http://127.0.0.1:8000/obsidian-spaced-repetition/](http://127.0.0.1:8000/obsidian-spaced-repetition/), any changes you make will reflect on the browser instantly.

### Translating Documentation

1. Create a folder for your language in `docs/` if it doesn't exist. Use the language codes provided [here](https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language).
2. Add the code from (1) to the MkDocs configuration (`mkdocs.yml` - `plugins.i18n.languages`).
3. Copy the files from the English (`en`) folder into the new folder.
4. Translate then open a pull request.

## Maintenance

### Releases

Example using `v1.9.2`:

1. Create a new branch: `git switch -c release-v1.9.2`
2. Bump the plugin version in `manifest.json` and `package.json` (following [Semantic Versioning](https://semver.org/spec/v2.0.0.html)).
- Semantic Versioning TL;DR, given a version number `MAJOR.MINOR.PATCH`, increment the:
- `MAJOR` version when you make incompatible API changes
- `MINOR` version when you add functionality in a backwards compatible manner
- `PATCH` version when you make backwards compatible bug fixes
- If the new version uses new Obsidian APIs, update `minAppVersion` and `versions.json` to reflect this.
3. Run `pnpm changelog` to update the CHANGELOG.
4. Commit and push the changes:

```bash
git add .
git commit -m "Bump version to v1.9.2"
git push --set-upstream origin release-v1.9.2
```

5. Open and merge the PR into `master`.
6. Locally, switch back to `master` and pull the changes: `git switch master && git pull`
7. Create a git tag with the version: `git tag 1.9.2`
8. Push the tag: `git push --tags`. <br> You're all set! [This GitHub action](https://github.com/st3v3nmw/obsidian-spaced-repetition/blob/master/.github/workflows/release.yml) should pick it up, create a release, publish it, and update the live documentation.

[^1]: Check the Obsidian Tasks project which has [excellent contribution guidelines](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/CONTRIBUTING.md).
Loading