Skip to content

Bug: Multiple TARGET DECK commands in a single file are ignored; all cards sent to the first deck #671

@rafaeltiberi

Description

@rafaeltiberi

I believe I've found a bug where the plugin fails to process multiple TARGET DECK commands within a single file.

When I create a note with cards intended for different decks, all cards are incorrectly sent to the first deck specified in the file. All subsequent TARGET DECK commands are ignored.

Steps to Reproduce
This bug occurs even in a brand new, perfectly formatted file with no other text.

Create a new, clean note in Obsidian (e.g., test.md).

Paste the following content, which specifies two different target decks:

Markdown

TARGET DECK: MyDecks::Deck-A

START
Basic
Test Card A
Verso:
This should go to Deck-A.
END


TARGET DECK: MyDecks::Deck-B

START
Basic
Test Card B
Verso:
This should go to Deck-B.
END
Run the Obsidian to Anki: Scan current file command.

Expected Behavior
"Test Card A" should be created in the MyDecks::Deck-A deck.

"Test Card B" should be created in the MyDecks::Deck-B deck.

Actual Behavior
Both "Test Card A" and "Test Card B" are created in the MyDecks::Deck-A deck.

The TARGET DECK: MyDecks::Deck-B command is ignored.

Troubleshooting Already Attempted
I have confirmed that the plugin settings are correct (no default deck is overriding this).

I have confirmed that START and END are on their own lines.

I have tried moving non-Anki text to the bottom of the file (or removing it entirely, as in the test above).

The issue persists regardless of formatting, which strongly suggests it is a bug in the plugin's parser.

Thank you for your work on this great plugin. I hope this report helps in tracking down the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions