fix: Show rarity setting not respected, :docs: Update README, fix: card preview clipping
2
.github/workflows/workflow.yml
vendored
|
|
@ -10,7 +10,7 @@ permissions:
|
|||
contents: read
|
||||
|
||||
env:
|
||||
version: '1.9.${{ github.run_number }}'
|
||||
version: '1.10.${{ github.run_number }}'
|
||||
nodeVersion: '22'
|
||||
|
||||
jobs:
|
||||
|
|
|
|||
151
README.md
|
|
@ -1,44 +1,131 @@
|
|||
# MTG Deck
|
||||
|
||||
This is a plugin to manage your Magic: The Gathering card collections and decks as Obsidian notes.
|
||||
An Obsidian plugin for Magic: The Gathering players. Paste a decklist into a code block and get a richly formatted, interactive deck view — with card previews, mana costs, prices, type grouping, and more.
|
||||
|
||||
This is a fork from the original [obsidian-mtg](https://github.com/omardelarosa/obsidian-mtg) plugin which seems unmaintained.
|
||||
# ✨ Features
|
||||
|
||||
## Decklists
|
||||
- **Instant rendering** — card names appear immediately, card data loads in the background
|
||||
- **Card previews** — hover over any card to see a preview image
|
||||
- **Double-faced card support** — click the preview image to flip between card faces
|
||||
- **Mana cost symbols** — displays official mana symbols from Scryfall
|
||||
- **Rarity indicators** — colored dot before each card count (black = common, silver = uncommon, gold = rare, orange = mythic)
|
||||
- **Type grouping** — cards are automatically sorted and grouped by type (Planeswalker, Creature, Instant, Sorcery, Artifact, Enchantment, Land)
|
||||
- **Type summary** — footer shows a count per card type with official card type icons
|
||||
- **Card prices** — shows prices in USD, EUR, or TIX via Scryfall
|
||||
- **Visual grid view** — toggle between list view and a visual grid of card images per section
|
||||
- **Collection tracking** — tracks how many copies you own and highlights missing cards
|
||||
- **Buylist** — automatically generates a buylist of missing cards
|
||||
- **Multiple decklist formats** — supports standard MTGO, Arena, and Moxfield export formats
|
||||
- **Hyperlinked card names** — optionally link card names to their Scryfall page
|
||||
- **Section support** — supports multiple sections (Deck, Sideboard, Commander, etc.)
|
||||
|
||||
Using the `mtg-deck` syntax hint in any Markdown file, you can define your decklists as follows:
|
||||
# 🖼️ Screenshots
|
||||
|
||||
```mtgdeck
|
||||
4 Delver of Secrets // Insectile Aberration
|
||||
4 Haughty Djinn
|
||||
3 Tolarian Terror
|
||||
4 Consider
|
||||
4 Essence Scatter
|
||||
4 Fading Hope
|
||||
4 Make Disappear # consider Negate instead
|
||||
4 Slip Out the Back
|
||||
3 Spell Pierce
|
||||
3 Thirst for Discovery
|
||||
20 Island
|
||||
1 Otawara, Soaring City
|
||||
1 Otherworldly Gaze
|
||||
1 Reckoner Bankbuster
|
||||
 
|
||||
|
||||
 
|
||||
|
||||

|
||||
|
||||
# ⬇️ Installation
|
||||
|
||||
This plugin is not yet available in the Obsidian Community Plugin directory. Install it using BRAT (Beta Reviewers Auto-update Tool).
|
||||
|
||||
1. Install BRAT from Settings → Community Plugins → Browse, search for BRAT, install and enable it
|
||||
2. Open Settings → BRAT and click Add Beta Plugin
|
||||
3. Enter the repository URL: https://github.com/sboulema/mtg-deck and click Add Plugin
|
||||
4. Enable the plugin under Settings → Community Plugins
|
||||
|
||||
BRAT will automatically notify you when updates are available.
|
||||
|
||||
# 🤲 Usage
|
||||
|
||||
Create a code block with the language set to `mtg-deck`:
|
||||
|
||||
````markdown
|
||||
```mtg-deck
|
||||
Deck:
|
||||
4 Ragavan, Nimble Pilferer
|
||||
4 Dragon's Rage Channeler
|
||||
4 Murktide Regent
|
||||
4 Counterspell
|
||||
4 Brainstorm
|
||||
4 Ponder
|
||||
4 Force of Will
|
||||
4 Daze
|
||||
4 Lightning Bolt
|
||||
4 Wasteland
|
||||
12 Island
|
||||
4 Volcanic Island
|
||||
4 Scalding Tarn
|
||||
|
||||
Sideboard:
|
||||
2 Disdainful Stroke
|
||||
4 Negate
|
||||
4 Out of the Way
|
||||
1 Reckoner Bankbuster
|
||||
4 Ertai's Scorn
|
||||
2 Pyroblast
|
||||
2 Red Elemental Blast
|
||||
3 Surgical Extraction
|
||||
2 Grafdigger's Cage
|
||||
2 Flusterstorm
|
||||
4 Back to Basics
|
||||
```
|
||||
````
|
||||
|
||||
## Supported Decklist Formats
|
||||
|
||||
**Standard format**:
|
||||
```
|
||||
4 Lightning Bolt
|
||||
4 Ragavan, Nimble Pilferer (MH2) 138
|
||||
```
|
||||
|
||||
Which in turn renders as:
|
||||
**Headed format**:
|
||||
```
|
||||
Deck:
|
||||
4 Lightning Bolt
|
||||
|
||||

|
||||
Sideboard:
|
||||
2 Pyroblast
|
||||
```
|
||||
|
||||
You can also copy paste directly from MTGA exports, though setlists and collector's numbers will not be shown and are not yet supported in the renderer.
|
||||
**Arena format**:
|
||||
```
|
||||
About
|
||||
Name My Deck Name
|
||||
Deck
|
||||
4 Lightning Bolt
|
||||
Sideboard
|
||||
2 Pyroblast
|
||||
```
|
||||
|
||||
## Collections
|
||||
## Comments
|
||||
|
||||
Inline comments can be added with `#`:
|
||||
|
||||
```
|
||||
4 Otawara, Soaring City # Is this necessary?
|
||||
1 Boseiju, Who Endures # Maybe cut?
|
||||
```
|
||||
|
||||
Full-line comments start with `# `:
|
||||
|
||||
```
|
||||
# Creatures
|
||||
4 Ragavan, Nimble Pilferer
|
||||
```
|
||||
|
||||
# Settings
|
||||
|
||||
Open **Settings → MTG Deck** to configure the plugin:
|
||||
|
||||
| Setting | Description |
|
||||
|---|---|
|
||||
| **Show mana costs** | Display mana cost symbols in a Cost column |
|
||||
| **Show card prices** | Display card prices in a Price column |
|
||||
| **Preferred currency** | Choose between USD ($), EUR (€), or TIX (Tx) |
|
||||
| **Show card previews** | Show card image on hover |
|
||||
| **Show card names as hyperlinks** | Link card names to their Scryfall page |
|
||||
| **Show buylist** | Show a buylist section for missing cards |
|
||||
|
||||
# Collection Tracking
|
||||
|
||||
This plugin expects your collection to be stored as csv files with the extension `.mtg.collection.csv` by default. This extension is configurable in settings:
|
||||
|
||||
|
|
@ -46,7 +133,7 @@ This plugin expects your collection to be stored as csv files with the extension
|
|||
|
||||
These files are expected to be properly formed CSVs such as those generated by tools like [Deckbox](https://deckbox.org/)
|
||||
|
||||
### Example CSV Files
|
||||
## Example CSV Files
|
||||
|
||||
```
|
||||
Name,Count,Set
|
||||
|
|
@ -65,6 +152,8 @@ Ledger Shredder,5,SNC
|
|||
|
||||
Note that your collection will consist of the merged result of all of your CSV files.
|
||||
|
||||
# Contributing
|
||||
# Credits
|
||||
|
||||
See [the official Obsidian plugin guidelines](https://github.com/obsidianmd/obsidian-sample-plugin#obsidian-sample-plugin)
|
||||
Built with the [Obsidian Plugin API](https://github.com/obsidianmd/obsidian-api) and [Scryfall API](https://scryfall.com/docs/api).
|
||||
|
||||
This is a fork from the original [obsidian-mtg](https://github.com/omardelarosa/obsidian-mtg) plugin which seems unmaintained.
|
||||
BIN
art/deck-card-dark.png
Normal file
|
After Width: | Height: | Size: 980 KiB |
BIN
art/deck-card-light.png
Normal file
|
After Width: | Height: | Size: 984 KiB |
BIN
art/deck-list-dark.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
art/deck-list-light.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 540 KiB |
|
Before Width: | Height: | Size: 171 KiB |
BIN
art/settings.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "mtg-deck",
|
||||
"name": "MTG Deck",
|
||||
"version": "1.9.58",
|
||||
"version": "1.10.59",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Display your MTG decks and card lists in your notes.",
|
||||
"author": "Samir Boulema",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mtg-deck",
|
||||
"version": "1.9.58",
|
||||
"version": "1.10.59",
|
||||
"description": "Display your MTG decks and card lists in your notes.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -32,12 +32,22 @@ export const setupCardPreview = (
|
|||
|
||||
faceIndex = 0;
|
||||
|
||||
imgElContainer.style.display = "block";
|
||||
imgElContainer.style.top = `${lineEl.offsetTop}px`;
|
||||
imgElContainer.style.right = "50px";
|
||||
imgElContainer.style.left = "auto";
|
||||
const getImgUri = (index: number): string | undefined => {
|
||||
if (cardInfo.image_uris) {
|
||||
return cardInfo.image_uris.large;
|
||||
}
|
||||
return cardInfo.card_faces?.[index]?.image_uris?.large;
|
||||
};
|
||||
|
||||
const imgUri = getImgUri(cardInfo, faceIndex);
|
||||
const rect = lineEl.getBoundingClientRect();
|
||||
imgElContainer.style.display = "block";
|
||||
imgElContainer.style.position = "fixed";
|
||||
imgElContainer.style.top = `${rect.top}px`;
|
||||
imgElContainer.style.right = `${window.innerWidth - rect.right}px`;
|
||||
imgElContainer.style.left = "auto";
|
||||
imgElContainer.style.zIndex = "1000";
|
||||
|
||||
const imgUri = getImgUri(faceIndex);
|
||||
if (imgUri) {
|
||||
imgEl.src = imgUri;
|
||||
}
|
||||
|
|
@ -46,7 +56,7 @@ export const setupCardPreview = (
|
|||
imgEl.style.cursor = "pointer";
|
||||
imgEl.onclick = () => {
|
||||
faceIndex = faceIndex === 0 ? 1 : 0;
|
||||
const uri = getImgUri(cardInfo, faceIndex);
|
||||
const uri = getImgUri(faceIndex);
|
||||
if (uri) {
|
||||
imgEl.src = uri;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,11 @@ export const renderSection = (
|
|||
|
||||
// Count cell
|
||||
const cardCountCell = lineEl.createEl("td");
|
||||
cardCountCell.createSpan({ cls: `card-rarity ${cardInfo?.rarity}` });
|
||||
|
||||
if (settings.decklist.showCardRarities) {
|
||||
cardCountCell.createSpan({ cls: `card-rarity ${cardInfo?.rarity}` });
|
||||
}
|
||||
|
||||
const cardCountEl = cardCountCell.createSpan({ cls: "count" });
|
||||
|
||||
// Name cell
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
/* Deck List */
|
||||
|
||||
.decklist {
|
||||
padding: 8px;
|
||||
padding: 8px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.decklist__section-container {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.decklist__section-container table {
|
||||
|
|
@ -70,10 +72,9 @@ span.comment {
|
|||
|
||||
.card-image-container {
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
z-index: 1000;
|
||||
pointer-events: auto;
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
.card-rarity {
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@
|
|||
"1.6.54": "0.15.0",
|
||||
"1.7.56": "0.15.0",
|
||||
"1.8.57": "0.15.0",
|
||||
"1.9.58": "0.15.0"
|
||||
"1.9.58": "0.15.0",
|
||||
"1.10.59": "0.15.0"
|
||||
}
|
||||