ObsidianToAnki / Obsidian_to_Anki

Script to add flashcards from text/markdown files to Anki
GNU General Public License v3.0
1.56k stars 137 forks source link

Some Flashcards are not added, even though I don't have any errors in Obsidian Console #469

Open Cloufish opened 11 months ago

Cloufish commented 11 months ago

Flashcards are not added, even though I don't have any errors in Obsidian Console

I use a specific regex expression: ((?:[^\n][\n]?)+) #flashcard ?\n*((?:\n(?:^.{1,3}$|^.{4}(?<!<!--).*))+) That is defined in the original documentation

However, when I run the plugin some Flashcards are created, and some not

  1. I checked regex expression and two of them (all tested) match the expression
  2. I use Basic Flashcard Type, and the Fields are being detected
  3. I have around 400 flashcards in my file, but only 290 are being created
  4. I cleared every setting from the menu—but this didn't help.
  5. I've set allowDuplicate: true in main.js in .obsidian/plugins/obsidian-to-anki-plugin folder
  6. Each flashcard has at least 2 new line characters
ShootingKing-AM commented 10 months ago

Same issue as https://github.com/ShootingKing-AM/Obsidian_to_Anki/issues/201, Locking the other Issue so discussion can continue on here.

hihvan commented 10 months ago

我也遇到同样的问题,默认正则表达式,在一个约40个抽认卡的md文件中,会有几个无法自动生成,但是把不能生成的文段复制到一个新建的md文件后,再次执行拓展插件,是可以正常生成的。

I also encountered the same problem, the default regular expression, in a md file of about 40 flashcards, there will be a few can not be automatically generated, but the text can not be generated to a new md file, the implementation of the extension plug-in can be generated normally.

问答题和cloze两种都有出现。

ShootingKing-AM commented 10 months ago

我也遇到同样的问题,默认正则表达式,在一个约40个抽认卡的md文件中,会有几个无法自动生成,但是把不能生成的文段复制到一个新建的md文件后,再次执行拓展插件,是可以正常生成的。

I also encountered the same problem, the default regular expression, in a md file of about 40 flashcards, there will be a few can not be automatically generated, but the text can not be generated to a new md file, the implementation of the extension plug-in can be generated normally.

问答题和cloze两种都有出现。

The translator is not working good. Cant understand your issue here. For any translator to work fine, use simpler and small sentences.

hihvan commented 10 months ago

The translator is not working good. Cant understand your issue here. For any translator to work fine, use simpler and small sentences.

**- here is the translation of my text into English:

I'm sorry, my previous statement was not accurate. Here is a revised explanation of the issue I encountered:

I also encountered a similar issue. When I imported a ".Markdown" file containing approximately 47 notes using the default provided regular expression (regex), I found that some notes were not recognized. No flashcards were generated for these notes. However, when I copied the unrecognized content into a newly created Markdown file, the regular expression was able to recognize it and generate flashcards. I hope this clarifies the issue I am experiencing.**

_很抱歉,我之前的表述不太准确,下面我重新整理一下我的语言,说明我遇到的情况。情况如下:

kafkazov commented 6 months ago

same problem.

haphanhp commented 5 months ago

me too. got the same thing. I checked with Dev Console, the connect was suceed but no cards added. I tried with both way, by note with syntax and by #flashcard

bulldo2er commented 1 month ago

Same issue. I investigated a bit and I believe the issue lies in the function add_spans_to_ignore(), specifically with the regex pattern OBS_INLINE_MATH_REGEXP. If there is a '$' and some lines and another '$', it might be incorrectly recognized as an inline math expression and consequently ignored. I created some flashcards to memorize Linux commands, which use ‘$’ as the prompt, and this bug appeared. As a temporary solution, I commented out the relevant line.