Skip to content

Adding embeddable cards in a backward compatible way.#91

Open
vavdoshka wants to merge 3 commits intojasonwilliams:mainfrom
vavdoshka:feat/embeded_cards
Open

Adding embeddable cards in a backward compatible way.#91
vavdoshka wants to merge 3 commits intojasonwilliams:mainfrom
vavdoshka:feat/embeded_cards

Conversation

@vavdoshka
Copy link
Copy Markdown

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
Copy Markdown
Owner

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

@vavdoshka
Copy link
Copy Markdown
Author

I just updated the logic slightly.

@jasonwilliams
Copy link
Copy Markdown
Owner

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

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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