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

How to stop text inclusion in Anki card? #51

Open
sophyphile opened this issue May 29, 2021 · 9 comments
Open

How to stop text inclusion in Anki card? #51

sophyphile opened this issue May 29, 2021 · 9 comments

Comments

@sophyphile
Copy link

Hi guys, apologies if this is a stupid question, I'm new to VS Code.

I want to add an Anki card, and then have some sort of closing operator, so that the text I write after it is not part of the Anki card. How can I do this? Is it possible with this software?

@jasonwilliams
Copy link
Owner

Hi @sophyphile sorry for the delayed response. I will have to try and add that as currently it’s not possible.

do you have an example to show which may help me fix this?

@KennethEnevoldsen
Copy link

Hi @jasonwilliams I have an a similar issue:

I have a case here:

# Topic header
Description of topic, notes etc.

first card:

## card 1
front1

%

back 1


# Topic header 2
Description of topic, notes etc.

## Card 2

front

%

back

Here the topic header 2 is included in the first card, which is naturally not the goal. One option would be to add a stop token (e.g. ## or \n\n)

@jasonwilliams
Copy link
Owner

Hmm yeah I wonder if stopping on a H1 would help? It already stops if it sees another h2 I believe. I’m open to ideas

@KennethEnevoldsen
Copy link

Stopping on H1 would help in my case. But adding an optional stopping token using regex would also be an option.

Another option would be to change the regex for detecting the card to instead of detecting the start of the card (##) use the regex to find the entire card e.g. the regex ^##((.|\n)*)## would match from ## to the next ##. If you don't want to include the ## then (?<=##)((.|\n)*?)(?=##)should also work.

@KennethEnevoldsen
Copy link

It seems it might be relevant to also remove ignore comment i.e. <!-- markdown comment -->.

@jasonwilliams
Copy link
Owner

#10 (comment) Uses <!— Card —> maybe that’s an options

@KennethEnevoldsen
Copy link

Sure. However, do believe that a field with a regex for extracting the card whether it be HTML comments or using another syntax would be ideal. This would allow the user to customize to their needs

@jasonwilliams
Copy link
Owner

Yes we should offer an option for that. I’m just thinking of the most reasonable default

@KennethEnevoldsen
Copy link

I Think HTML comment is a poor default though as it is also a comment thus I would expect it to ignore it in markdown documents potentially one of these from the anki integration with obsidian: https://github.com/Pseudonium/Obsidian_to_Anki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants