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

Adding embeddable cards in a backward compatible way. #91

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vavdoshka
Copy link

Added embeddable cards in a backward-compatible way. Allows limiting the scope of the processing to the content between <!-- BEGIN_ANKI_CARDS --> and <!-- END_ANKI_CARDS --> comments.

I found it helpful to embed the Anki Cards definitions into documents with some knowledge base data.
This change is backward compatible and should work with all the existing features from how far I've tested.

…ng the scope of the processing to the content between <!-- BEGIN_ANKI_CARDS --> and <!-- END_ANKI_CARDS --> comments.
@jasonwilliams
Copy link
Owner

Hey @vavdoshka thanks for this PR, looks good. I’ll try and take a proper look

@vavdoshka
Copy link
Author

I just updated the logic slightly.

@jasonwilliams
Copy link
Owner

Hey @vavdoshka, Implementation looks good, it may be worth adding a test here or here

@@ -56,33 +56,30 @@ export class MarkdownFile {


private extractMarkedText(content: string): string {
// extract the text between markers - markdown comments <!-- BEGIN_ANKI_CARDS --> text <!-- END_ANKI_CARDS -->
// if the markers are not present then return the entire content
// Extract the text between markers - markdown comments <!-- BEGIN_ANKI_CARDS --> text <!-- END_ANKI_CARDS -->
Copy link
Owner

@jasonwilliams jasonwilliams Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move these comments above the function using /** */ syntax?
its just so then you would get the function description when hovering over the symbol

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, cool, thanks. I'll do it as soon as I can.
Yes, I am also planning to add an action (command) to start the embedded Anki card, which will paste the markers under a cursor and move the cursor inside the quotes.

<!-- BEGIN_ANKI_CARDS -->
|
<!-- END_ANKI_CARDS -->

Any suggestions for the naming of that action? Thought of Anki: Start Embedded Cards.

Copy link
Owner

@jasonwilliams jasonwilliams Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anki: Start Embedded Cards

Should this be offered as a snippet instead? It looks more like a snippet than a full-on-command. I think the extension can contribute snippets

@jasonwilliams
Copy link
Owner

Pings @vavdoshka are you still active on this?

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

Successfully merging this pull request may close these issues.

2 participants