st3v3nmw / obsidian-spaced-repetition

Fight the forgetting curve by reviewing flashcards & entire notes on Obsidian
https://www.stephenmwangi.com/obsidian-spaced-repetition/
MIT License
1.59k stars 189 forks source link

[FEAT] Support questions within admonition code blocks #747

Open DanielChicoUGR opened 1 year ago

DanielChicoUGR commented 1 year ago

Modify the parser to search inside the code blocks. With the use of the Admonition plugin, the text inside is not detected as flashcard.

ronzulu commented 1 year ago

Hi there, can you include some sample Markdown.

DanielChicoUGR commented 1 year ago

Here is what i mean. Screenshot_2023-09-25-11-47-35-723_md.obsidian.jpg

Screenshot_2023-09-25-11-47-45-987_md.obsidian.jpg

Thats part of my Fundaments of networks homework

I have looked the code of the parser but i dont know where to edit, (obviusly in the parser file....)

ronzulu commented 1 year ago

Hi there

The parse function seems to explicitly skip over the content of code blocks, anything starting with ``` or ~~~.

I can imagine that in general that makes sense, code could easily have :: within a line for example,

A couple of options come to mind for implementation

  1. Include a new user option which would specify which types of code blocks should be parsed for questions.
  2. Some kind of markup within individual code blocks... perhaps just some variation of the standard
    <!--SR:!2023-09-20,1,230-->

Cheers Ronny

DanielChicoUGR commented 1 year ago

OOOO u are right, ill try something and i will make a pull req if i have something interesting

Stefanuk12 commented 1 year ago

Expanding on a possible implementation, ignore any "termination" tokens if we are currently within a code block. The regex could be altered to account for this.

reinvanimschoot commented 9 months ago

Hey guys, is there any update on this? Or any workaround? I made an admonition called sr-cards only to realise that the cards are not picked up inside it haha. But it is much cleaner to have a folded admonition to store the cards, so I'm hoping for a workaround!

DanielChicoUGR commented 9 months ago

Next week i end the smester and try some thoughts 😅😅😅😅

DanielChicoUGR commented 8 months ago

panding on a possible implementation, ignore any "termination" tokens if we are currently within a code block. The regex could be altered to account for this.

Reading about this, how do u implement this way???

Stefanuk12 commented 8 months ago

You can probably get AI to write the regex for the most part but if you match a ```, then don't match any ==, until the next. I'm not sure myself but it was just an ide.

DanielChicoUGR commented 8 months ago

I got it, how can i make the pull request?, if i can, i can eve paste the code here, there was not so much code.

Questions before, i need to upgrade the doc, where i put that?

And last question, it pass the test but the summary dont say that image

image

What i need to do?

ronzulu commented 8 months ago

Hi @DanielChicoUGR

I got it, how can i make the pull request?, if i can, i can eve paste the code here, there was not so much code.

Pull requests are on a menu near the top of this page. Otherwise, here is the direct link: https://github.com/st3v3nmw/obsidian-spaced-repetition/pulls

Questions before, i need to upgrade the doc, where i put that?

Great, most people don't think about documentation :smile: https://www.stephenmwangi.com/obsidian-spaced-repetition/contributing/

And last question, it pass the test but the summary dont say that !

Ideally, we would have 100% code coverage for non-GUI classes. We don't have that, but at the moment a handful of classes that the test framework Jest has been configured to check.

This includes parser.ts

image

Cheers Ronny

DanielChicoUGR commented 8 months ago

If just created the pr, if u need me to modify something just ask :)