Skip to content

Commit

Permalink
chore: update dependencies, linting, & tests (#1056)
Browse files Browse the repository at this point in the history
* Full coverage for UnitTest utils

* Change test config

* Added Unit Test for stats

* Added Unit Test for NumberCountDict

* Add function parseDateToTicks, formatDate

* Fix includes and doc

* Added Testcases

* Remove unused function

* Try fix ticksFromDate

* Fix lint

* [FIX] isEqualOrSubPath function (#1048)

* Improve isEqualOrSubPath Description + remove use of normalize

* update changelog

* fix linting

* update changelog

* Revert "update changelog"

This reverts commit d7ba801.

* Update Changelog

* feat: refactor code to support diff methods of storing the scheduling info, and diff SR algorithms (#1006)

* Perhaps half way towards implementation; doesn't build yet

* Implemented 70%; doesn't build

* Progress

* Progress

* Progress

* 11 of the 19 existing test suites pass

* 12 of the 19 existing test suites pass

* 14 of the 19 existing test suites pass

* Progress

* 15 of the 19 existing test suites pass

* All nineteen existing test suites pass

* Minor fixes

* More refactoring; doesn't build

* Progress, doesn't build

* Builds and all existing unit tests pass

* Progress

* Merge remote-tracking branch 'upstream/master'; due to conflicts fair manual work involved to complete merge with unit test cases working

* Continued fixing post #495 integration

* Added some test cases for OsrCore

* Added unit test support code

* Added more test files

* Added test case, fixed code issues

* Updated tests

* Small refactor

* !!GitHub_Desktop<feat-878-support-multiple-schedule-methods>

* Fixes post merge stash

* Added tests

* More refactoring

* Improved test coverage

* Improved unit test code coverage

* Starting testing of plugin within Obsidian

* Bug fixes

* Fixed broken test cases

* Added test case for global coverage

* A few merge fixes

* Version ready for beta testing

* Format and lint

* Updated actions/checkout@v3 to node 20

* Lets make lint happy!

* Previously the pnpm format added a blank line in a test markdown file which caused the test to fail

* Slightly reduced jest code coverage threshold to writing a number of difficult test cases

* Fixed bug where note frontmatter interval/ease set to null (app specific code, not core code)

* Fixed some note review queue bugs (previously introduced in branch #878)

* Lint & format

* Fixed bug preventing stats being shown (previously introduced in branch #878)

* Squashed commit of the following:

commit 3228e9c
Author: Ronny Zulaikha <75528127+ronzulu@users.noreply.github.com>
Date:   Wed Jul 24 15:10:39 2024 +1000

    Support RTL flashcards specified by frontmatter "direction" attribute (#935)

    * Nearly completed

    * Added RTL support for flashcards edit modal

    * Changes as part of the merge

    * post upstream master merge fixes

    * Minor code improvement

    * lint and format

    * Change log and documentation update

    * Minor code change

    * Fixed EditModal RTL

    * lint and format

    * Updated test cases to fix global coverage error

    * Format & lint

commit 971e4af
Author: Anna Zubenko <anna_zubenko@fastmail.com>
Date:   Mon Jul 22 07:29:18 2024 +0200

    FEAT-990 Mobile landscape mode and functional size sliders (#998)

commit a89a818
Author: 4Source <38220764+4Source@users.noreply.github.com>
Date:   Mon Jul 22 07:25:45 2024 +0200

    [FIX] Cards missing when horizontal rule present in document (#970)

    * Use obsidians funtion to extractFrontmatter

    * Fix line pos shift

    * Stop using obsidian function because of UnitTest

    * Add UnitTest for Frontmatter and Horizontal line

    * Fix linting

    ---------

    Co-authored-by: Stephen Mwangi <mail@stephenmwangi.com>

commit 77f15e1
Author: Carlos Galdino <carloshsgaldino@gmail.com>
Date:   Mon Jul 22 06:02:11 2024 +0100

    Filter due notes when all are scheduled (#947)

    Ignore notes due in the future.

    Fixes #548

commit 83590be
Author: Newdea <9208450+Newdea@users.noreply.github.com>
Date:   Sat Jul 20 15:10:57 2024 +0800

    fix #1000 sidebar indent (#1001)

commit e3a0146
Author: 4Source <38220764+4Source@users.noreply.github.com>
Date:   Sat Jul 20 09:02:14 2024 +0200

    [FIX] Include link parsing for Review context (#964)

    * Include link parsing

    * Fix linting

commit 3024264
Author: 4Source <38220764+4Source@users.noreply.github.com>
Date:   Sat Jul 20 09:00:46 2024 +0200

    [FIX] Not scroll back to top after review (#971)

    * Update deprecated function

    * Add scroll back to top

    * Fix linting

commit 1dfd52e
Author: 4Source <38220764+4Source@users.noreply.github.com>
Date:   Sat Jul 20 09:00:33 2024 +0200

    [FIX] Folder ignore sorts all folder starting with string (#972)

    * Implement isEqualOrSubPath

    * Implement UnitTest for isEqualOrSubPath

    * Replace separators with system seperator

    * Improved seperator replacement

commit b175d22
Author: artificialUsagi <41666068+artefaritaKuniklo@users.noreply.github.com>
Date:   Sat Jul 20 14:59:11 2024 +0800

    add translation: zh-cn (#982)

* Format & lint

* fix: changelog formatting

* Post review fixes

* Format and lint

* Format & lint

---------

Co-authored-by: Stephen Mwangi <mail@stephenmwangi.com>

* chore: update dependencies, linting, & tests

* update eslint

* lower coverage threshold

* minor fixes

---------

Co-authored-by: 4Source <38220764+4Source@users.noreply.github.com>
Co-authored-by: Ronny Zulaikha <75528127+ronzulu@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 21, 2024
1 parent 8876f34 commit b9f25ff
Show file tree
Hide file tree
Showing 147 changed files with 4,902 additions and 3,886 deletions.
22 changes: 0 additions & 22 deletions .eslintrc.json

This file was deleted.

2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ docs/docs/en/media/~*

# env
env.sh


2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use-node-version=20.1.0
use-node-version=20.17.0
7 changes: 2 additions & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
build
coverage
node_modules
.yarn
.pnp.cjs
.pnp.loader.mjs
pnpm-lock.yaml
tests/e2e/vault/
tests/vaults
docs
tests/vaults/
docs/user-doco-vault/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Fight the forgetting curve & note aging by reviewing flashcards & notes using sp
- Check the [roadmap](https://github.com/st3v3nmw/obsidian-spaced-repetition/projects/3/) 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.
- The plugin has been translated into _Arabic / العربية, Chinese (Simplified) / 简体中文, Chinese (Traditional) / 繁體中文, Czech / čeština, German / Deutsch, Italian / Italiano, Korean / 한국어, Japanese / 日本語, Polish / Polski, Portuguese (Brazil) / Português do Brasil, Spanish / Español, and Russian / русский_ by the Obsidian community 😄.
- The plugin has been translated into _Arabic, Chinese, Czech, German, Italian, Korean, Japanese, Polish, Portuguese, Spanish, Russian, and Turkish_ by the Obsidian community 😄.
- To help translate this plugin to your language, check the [translation guide here](https://www.stephenmwangi.com/obsidian-spaced-repetition/contributing/#translating_1).

## Features
Expand Down
769 changes: 386 additions & 383 deletions docs/docs/changelog.md

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions docs/docs/en/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

A learning algorithm is a formula that determines when a note or flashcard should next be reviewed.

Algorithm | Status
- | -
[SM-2-OSR](#sm-2-osr) | Implemented
[FSRS](#fsrs) | Planned
[User Defined Intervals](#user-specified-intervals) | Planned
| Algorithm | Status |
| --------------------------------------------------- | ----------- |
| [SM-2-OSR](#sm-2-osr) | Implemented |
| [FSRS](#fsrs) | Planned |
| [User Defined Intervals](#user-specified-intervals) | Planned |

## SM-2-OSR

- The `SM-2-OSR` algorithm is a variant of [Anki's algorithm](https://faqs.ankiweb.net/what-spaced-repetition-algorithm.html) which is based on the [SM-2 algorithm](https://www.supermemo.com/en/archives1990-2015/english/ol/sm2).
- It supports ternary reviews i.e. a concept is either hard, good, or easy at the time of review.
- initial ease is weighted (using max_link_factor) depending on the average ease of linked notes, note importance, and the base ease.
- Anki also applies a small amount of random “fuzz” to prevent cards that were introduced at the same time and given the same ratings from sticking together and always coming up for review on the same day."
- The algorithm is essentially the same for both notes and flashcards - apart from the PageRanks
- The algorithm is essentially the same for both notes and flashcards - apart from the PageRanks

### Algorithm Details

Expand All @@ -23,8 +23,7 @@ Algorithm | Status
Note that this hasn't been updated in a while,
please see the [code](https://github.com/st3v3nmw/obsidian-spaced-repetition/blob/master/src/scheduling.ts).

- `if link_count > 0: initial_ease = (1 - link_contribution) * base_ease + link_contribution * average_ease`
- `link_contribution = max_link_factor * min(1.0, log(link_count + 0.5) / log(64))` (cater for uncertainty)
- `if link_count > 0: initial_ease = (1 - link_contribution) * base_ease + link_contribution * average_ease` - `link_contribution = max_link_factor * min(1.0, log(link_count + 0.5) / log(64))` (cater for uncertainty)
- The importance of the different concepts/notes is determined using the PageRank algorithm (not all notes are created equal xD)
- On most occasions, the most fundamental concepts/notes have higher importance
- If the user reviews a concept/note as:
Expand All @@ -42,7 +41,6 @@ Algorithm | Status

---


## FSRS

The algorithm is detailed at:
Expand All @@ -53,7 +51,6 @@ Incorporation of the FSRS algorithm into this plugin has not yet occurred. For p

---


## User Specified Intervals

This is the simplest "algorithm" possible. There are fixed intervals configured by the user for each of the possible review outcomes.
Expand Down
28 changes: 13 additions & 15 deletions docs/docs/en/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ First off, thanks for wanting to contribute to the Spaced Repetition plugin!

The plugin has been translated into the following languages by the Obsidian community 😄.

- Arabic / العربية
- Chinese (Simplified) / 简体中文
- Chinese (Traditional) / 繁體中文
- Czech / čeština
- German / Deutsch
- Italian / Italiano
- Korean / 한국어
- Japanese / 日本語
- Polish / Polski
- Portuguese (Brazil) / Português do Brasil
- Spanish / Español
- Russian / русский
- Arabic / العربية
- Chinese (Simplified) / 简体中文
- Chinese (Traditional) / 繁體中文
- Czech / čeština
- German / Deutsch
- Italian / Italiano
- Korean / 한국어
- Japanese / 日本語
- Polish / Polski
- Portuguese (Brazil) / Português do Brasil
- Spanish / Español
- Russian / русский
- Turkish / Türkçe

### Steps

Expand Down Expand Up @@ -73,7 +74,6 @@ Please note that:

---


## Code

1. Make your changes.
Expand Down Expand Up @@ -111,7 +111,6 @@ Please note that:

---


## Documentation

The documentation consists of Markdown files which [MkDocs](https://www.mkdocs.org/) converts to static web pages.
Expand Down Expand Up @@ -149,7 +148,6 @@ For larger diffs, it's important that you check how your docs look like as expla
---
## Maintenance
### Releases
Expand Down
15 changes: 8 additions & 7 deletions docs/docs/en/data-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
This is the original method used for storing the scheduling information for cards and notes.

For cards this is stored in an HTML comment for that card. For example with the card:

```
The RCU and WCU limits for a single partition key value::3000 RCU, 1000 WCU
```

When the card is reviewed, an HTML comment will be added after the card's text, such as:

```
<!--SR:!2024-08-16,51,230-->
```
Expand All @@ -26,11 +28,12 @@ For example:
![note-frontmatter](https://github.com/user-attachments/assets/b9744f50-c897-46ad-ab34-1bbc55796b57)

!!! note "Raw text format"
---
sr-due: 2024-07-01
sr-interval: 3
sr-ease: 269
---

---
sr-due: 2024-07-01
sr-interval: 3
sr-ease: 269
---

### Single Scheduling File

Expand All @@ -48,8 +51,6 @@ All user [options](user-options.md) are stored in `data.json` in the plugin fold

---



## Card Postponement List

This records a list of cards reviewed today that have sibling cards that shouldn't be reviewed until tomorrow.
Expand Down
10 changes: 7 additions & 3 deletions docs/docs/en/flashcards/basic-cloze-cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ The front of the card is displayed as the text with (one or more) `cloze deletio
A part of the card text is identified as a cloze deletion by surrounding it with the `cloze delimiter`.

### Single Cloze Deletion

By default, the cloze delimiter is `==`, and a simple cloze card would be:

```
The first female prime minister of Australia was ==Julia Gillard==
```

!!! note "Displayed when reviewed"

<div class="grid" markdown>

!!! tip "Initial View"
Expand All @@ -29,17 +32,18 @@ The first female prime minister of Australia was ==Julia Gillard==

</div>



### Multiple Cloze Deletions

If the card text identifies multiple parts as cloze deletions, then multiple cards will be shown for review, each one occluding one deletion, while leaving the other deletions visible.

For instance, the following note:

```
The first female ==prime minister== of Australia was ==Julia Gillard==
```

!!! note ""

<div class="grid" markdown>

!!! tip "Card 1 Initial View"
Expand All @@ -63,7 +67,6 @@ These two cards are considered sibling cards. See [sibling cards](flashcards-ove

The cloze delimiter can be modified in [settings](../user-options.md#flashcard-review), e.g. to `**`, or curly braces `{{text in curly braces}}`.


<!--
## Cloze Hints
Expand Down Expand Up @@ -106,4 +109,5 @@ and this also ==in group 1==[^1]
## Anki style

!!! warning

Anki style `{{c1:This text}} would {{c2:generate}} {{c1:2 cards}}` cloze deletions are not currently supported. This feature is being tracked [here](https://github.com/st3v3nmw/obsidian-spaced-repetition/issues/93/).
2 changes: 2 additions & 0 deletions docs/docs/en/flashcards/cards-with-blank-lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ needs to be changed.
For example, it could be changed to `+++`.

!!! warning "Global Edit Required"

Note that after changing this you have to manually edit any flashcards you already have.

## Including a Table in the Flashcard Answer

!!! note "Obsidian requires a blank line before a table for it to be displayed correctly."

Without it, Obsidian displays it just as text and not correctly formatted.

![table-with-no-preceding-blank-line](https://github.com/user-attachments/assets/daed1309-3b38-4d14-bb42-b302efda96df)
Expand Down
2 changes: 0 additions & 2 deletions docs/docs/en/flashcards/decks.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

![flashcard-decks-1](https://github.com/user-attachments/assets/a207b0f6-b064-443c-9c55-540681b10891)


## Using Obsidian Tags

1. Specify flashcard tags in settings (`#flashcards` is the default).
Expand Down Expand Up @@ -68,7 +67,6 @@ Here `Question6` will be part of `deckA` and not `deckB` as `deckB` is specific

---


## Using Folder Structure

The plugin will automatically search for folders that contain flashcards & use their paths to create decks & sub-decks
Expand Down
29 changes: 16 additions & 13 deletions docs/docs/en/flashcards/flashcards-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Flashcards are defined within standard Obsidian markdown files.

A markdown file containing flashcards must identify the [deck](decks.md) (or decks) into which the flashcards are placed.
A markdown file containing flashcards must identify the [deck](decks.md) (or decks) into which the flashcards are placed.
However, the file does not need to be tagged as a [note](../notes.md) for it to have flashcards defined.

Two types of flashcards are supported:
Expand All @@ -12,48 +12,52 @@ Two types of flashcards are supported:
!!! note "Question & Answer"

[Question & Answer](qanda-cards.md) flashcards are ones where the flashcard text contains both the question text and answer text.

<hr class="thin">
![flashcard-qanda-example](https://github.com/user-attachments/assets/65639d80-b249-4b16-ae40-c2af011c6aab)

!!! note "Cloze"

[Cloze](basic-cloze-cards.md) flashcards are ones where the flashcard text identifies parts of the text (e.g. a word or phrase) that is hidden
[Cloze](basic-cloze-cards.md) flashcards are ones where the flashcard text identifies parts of the text (e.g. a word or phrase) that is hidden
when the front of the card is shown. <br/>
The hidden text is known as a `cloze deletion`.
<hr class="thin">
![flashcard-cloze-example](https://github.com/user-attachments/assets/9fb12f2e-9b81-45d9-9097-7f1e3d97ae5a)

</div>

!!! tip
For guidelines on how to write and structure flashcards, see [Spaced Repetition Guides]( ../resources.md#flashcards)

For guidelines on how to write and structure flashcards, see [Spaced Repetition Guides](../resources.md#flashcards)

---

## Flashcard Text, Flashcards and Cards

!!! note

For simplicity `flashcard text` is sometimes written just as `flashcard`

The `flashcard text` is text that defines the type and content of a card (or a set of related, `sibling` cards).

### Single flashcard, multiple cards

For some flashcard types, the flashcard text defines a single card. For other flashcard types, multiple
cards are defined.

Flashcard Type | Cards Defined
- | -
[Single-line Basic](qanda-cards.md#single-line-basic) | flashcard defines the front and back of a single card.
[Single-line Bidirectional](qanda-cards.md#single-line-bidirectional) | flashcard defines two cards.
[Multi-line Basic](qanda-cards.md#multi-line-basic) | flashcard defines the front and back of a single card.
[Multi-line Bidirectional](qanda-cards.md#multi-line-bidirectional) | flashcard defines two cards.
[Cloze](basic-cloze-cards.md) | flashcard defines multiple cards, the number of cards based on the number of cloze deletions.
| Flashcard Type | Cards Defined |
| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [Single-line Basic](qanda-cards.md#single-line-basic) | flashcard defines the front and back of a single card. |
| [Single-line Bidirectional](qanda-cards.md#single-line-bidirectional) | flashcard defines two cards. |
| [Multi-line Basic](qanda-cards.md#multi-line-basic) | flashcard defines the front and back of a single card. |
| [Multi-line Bidirectional](qanda-cards.md#multi-line-bidirectional) | flashcard defines two cards. |
| [Cloze](basic-cloze-cards.md) | flashcard defines multiple cards, the number of cards based on the number of cloze deletions. |

### Sibling Cards

If there are multiple cards defined by a single flashcard, those cards are known as `sibling` cards.

A special scheduling option is available for the review of sibling cards. If the [Bury sibling cards until the next day]( ../user-options.md#flashcard-review) setting is turned on,
A special scheduling option is available for the review of sibling cards. If the [Bury sibling cards until the next day](../user-options.md#flashcard-review) setting is turned on,
only one sibling card is available for review on a single day.

### Including Blank Lines within Multiline and Cloze Flashcards
Expand All @@ -65,7 +69,6 @@ See [Cards with Blank Lines](cards-with-blank-lines.md) if blank lines need to b

---


## RTL Support

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

0 comments on commit b9f25ff

Please sign in to comment.