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

feat: adding fallbacks for bullet lists #1180

Merged
merged 6 commits into from
Jul 14, 2023
Merged

feat: adding fallbacks for bullet lists #1180

merged 6 commits into from
Jul 14, 2023

Conversation

aalemayhu
Copy link
Contributor

@aalemayhu aalemayhu commented Jun 14, 2023

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

The capital of France is _____. - Paris.

That generates the following flashcard:

Front of the card: The capital of France is {{c1::Paris}}.

Basic card

Input:

What is the capital of Kosovo? - Pristina

Output:

Front of the card: What is the capital of Kosovo?
Back of the card: Pristina

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!

@sonarcloud
Copy link

sonarcloud bot commented Jul 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@aalemayhu aalemayhu merged commit 6c422fb into main Jul 14, 2023
5 checks passed
@aalemayhu aalemayhu deleted the feat/bullets branch July 14, 2023 18:29
This was referenced Jul 15, 2023
Copy link

🎉 This PR is included in version 0.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

1 participant