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

typ2anki:0.1.0 #1490

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
21 changes: 21 additions & 0 deletions packages/preview/typ2anki/0.1.0/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Santiago

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
167 changes: 167 additions & 0 deletions packages/preview/typ2anki/0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Typ2Anki

**Typ2Anki** is a Typst package designed to create flashcards seamlessly within Typst-based notes. This package enables users to structure flashcards directly in their documents for easy integration with study and review workflows.

- Create customizable flashcards using Typst syntax.
- Supports structured note-taking with consistent flashcard styling.
- Ideal for educational and professional use.

---

## Table of Contents

1. **[Installation and Configuration](#installation-and-configuration)**

- [Installing the Typst Package](#installing-the-typst-package)

2. **[Usage](#usage)**

- [Basic Workflow](#basic-workflow)
- [Customizing Cards](#customizing-cards)

3. **[Troubleshooting](#troubleshooting)**

- [Common Issues](#common-issues)

4. **[Roadmap](#roadmap)**

5. **[Future Plans](#future-plans)**

6. **[Contributing](#contributing)**

7. **[License](#license)**

---

## Installation and Configuration

### Complete Integration

To fully utilize Typ2Anki, ensure you follow the installation instructions for the Python package available at [https://github.com/sgomezsal/typ2anki](https://github.com/sgomezsal/typ2anki).

### Installing the Typst Package

1. Add the Typ2Anki package to your Typst document:

```typst
#import "@preview/typ2anki:0.1.0"
```

2. Place your custom configuration file (`ankiconf.typ`) in the project directory for consistent flashcard rendering.

```typst
// Custom imports for flashcards
#import "@preview/pkgs"

#let conf(
doc,
) = {
// Custom configurations
doc
}
```

---

## Usage

### Examples

For detailed examples, visit the [examples folder](https://github.com/sgomezsal/typ2anki/tree/main/examples) in the original repository.

### Important Note

For full functionality, this Typst package requires the complementary Python package. Installation and usage instructions can be found at [https://github.com/sgomezsal/typ2anki](https://github.com/sgomezsal/typ2anki).

### Basic Workflow

1. Create a Typst file with flashcards:

```typst
#card(
id: "001",
target-deck: "Typst",
q: "What is Typst?",
a: "A modern typesetting system."
)
```

2. Create your `ankiconf.typ` file with basic configurations:

```typst
// Custom imports for flashcards
#import "@preview/pkgs"

#let conf(
doc,
) = {
// Custom configurations
doc
}
```

3. Compile your Typst document using Typst's built-in commands to render the flashcards.

---

### Customizing Cards

To modify card appearance, you can define custom card logic:

```typst
#let custom-card(
id: "",
Q: "",
A: "",
..args
) = {
card(
id: id,
Q: Q,
A: A,
container: true,
show-labels: true
)
}
```

---

## Troubleshooting

### Common Issues

- **Typst file compilation errors**:
- Check for syntax issues in your Typst file.
- Ensure your `ankiconf.typ` contains the necessary imports and configurations.

---

## Roadmap

1. **Support for Advanced Flashcard Formats**: Add enhanced support for multi-part and hierarchical flashcards.
2. **Efficiency Improvements**: Optimize rendering for large Typst projects with numerous flashcards.
3. **Integration Enhancements**: Explore integration with additional Typst features for more dynamic output.

---

## Future Plans

- Expand compatibility to support more flashcard types.
- Introduce configuration options for easier customization of flashcard styles.

---

## Contributing

Contributions are welcome! Feel free to open issues or submit pull requests for bug fixes, feature enhancements, or documentation improvements.

---

## License

This project is licensed under the [MIT License](LICENSE).

---

Developed with ❤️ by [sgomezsal](https://github.com/sgomezsal). Let’s make learning efficient and enjoyable!
1 change: 1 addition & 0 deletions packages/preview/typ2anki/0.1.0/src/assets/anki.svg
Copy link
Member

Choose a reason for hiding this comment

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

Unless this logo is under the MIT license too, there should at least be a note in the README about its license/copyright information. And if it is MIT, the copyright line in the license file should be updated.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback! I’ve replaced the previous icon with one from Phosphor Icons, which is licensed under the MIT License.

I’ve also updated the README.md to include a section specifying the icon's license, and added a note to the LICENSE file to reflect its usage.

Please let me know if there's anything else that needs to be addressed!

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions packages/preview/typ2anki/0.1.0/src/lib.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#import "@preview/gentle-clues:1.1.0": *

#let card-container(
title: "Anki",
icon: image("assets/anki.svg"),
..args
) = {
clue(
title: title,
icon: icon,
accent-color: rgb(4, 165, 229),
..args
)
}

#let card(
id: "",
q: "",
a: "",
..args
) = {
let args = arguments(
type: "basic",
container: false,
show-labels: false,
..args
)

if args.at("container") == false {
if args.at("show-labels") == true {
context [
Q: #q \
A: #a
]
} else {
context [
#q \
#a
]
}
} else {
if args.at("show-labels") == true {
card-container[
Q: #q \
A: #a
]
} else {
card-container[
#q \
#a
]
}
}
}

11 changes: 11 additions & 0 deletions packages/preview/typ2anki/0.1.0/typst.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "typ2anki"
version = "0.1.0"
entrypoint = "src/lib.typ"
authors = ["sgomezsal <[email protected]>"]
license = "MIT"
description = "Convert Typst files into Anki cards automatically."
repository = "https://github.com/sgomezsal/typ2anki"
keywords = ["anki", "flashcards", "typst", "automation"]
categories = ["integration", "utility"]
compiler = "0.12.0"
Loading