feat: adding fallbacks for bullet lists #1180
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code is ugly as hell but this adds a new fallback parser. For power users who already have an established workflow, this will not introduce any issues but only be triggered when their upload would not create any flashcards.
It relies heavily on the format suggested here #1178:
The fallback parser takes a bullet list as input and generates one or more flashcards for each bullet point. The bullet points are separated by a blank line (\n). In the bullet point, the question and answer are separated by a dash (-). If there are more answers, f.ex. in the close deletion case, then answers are comma delimited after the dash (answer1, answer, etc.)
Examples
Cloze card
That generates the following flashcard:
Basic card
Input:
Output:
Supported formats
Note this does not work in the Notion integration but is a fallback mechanism added for people uploading files that are not handled by the current DeckParser. So I am hoping people see the error message about no cards less often with this change. This is a fallback so things like styling and images do not work.
Markdown, HTML, and ZIP support work for the fallback parser. But note that there might be some unexpected issues like the styling is not applied and there are cases where the front gets duplicated content.
Enjoy!