Obsidian_to_Anki icon indicating copy to clipboard operation
Obsidian_to_Anki copied to clipboard

Allow Cards to be inside/in form of a code block

Open marvin-te opened this issue 3 years ago • 2 comments

Hi there!

I was just wondering if there was a specific reason on why Obsidian_to_Anki ignores Code Blocks. I have the Admonition Plugin installed, which creates material styled, themable, collapsable blocks, which I would love to use as flashcards like so: image

Which would then be rendered like so: image

The RegEx for this would be

(?:```ad-flashcard\n+)((?:.+\n)*?)(?:_{3,}\n)((?:.+\n)*?)(?:`{3}\n?)

Sadly - after hours of trying to find the mistake in my RegEx - I noticed, that the problem actually lies in the code block itself. OtA seems to ignore it completely.

Is there a way to make this work?

Thanks.

marvin-te avatar Nov 11 '21 00:11 marvin-te

I just found out, that you can make it work by commenting out this Line: this.ignore_spans.push(...spans(c.OBS_CODE_REGEXP, this.file)) In this file

Still I am wondering what the reason for this line is. I don't feel quite comfortable doing this when it could have severe side effects.

Does anyone have an answer to this question?

marvin-te avatar Nov 11 '21 10:11 marvin-te

Would love a better solution to this, as well!

@marvin-te thanks for the suggestion above - though it doesn't work as intended, as the curly brackets in the code will act as random cards.

@Pseudonium would it be possible to have another notation for cards inside code? PS. thank you for an amazing plugin! It is seriously the most underrated workflow!!

sebastianromano avatar Dec 21 '21 16:12 sebastianromano