Package: panki
pankiA project management tool for Anki deck builders.ContentsInstallationGetting StartedScaffoldingProject ScaffoldingConfigurationProject ConfigurationNote Type ConfigurationCard Type ConfigurationDeck ConfigurationNote ConfigurationNote DataTemplates and StylingWorking with Anki CollectionsDumping Package FilesExporting Anki CollectionsLicenseInstallationYou can install panki with pip:$pipinstallpankiYou should be able to use panki now:$panki--helpIf you are starting a fresh project, please see theGetting Startedsection.
This section will walk you through setting up a basic project with panki. Panki
is very flexible - if the basic project structure is too simple for your needs,
please see theexamples/directory for example project structures and theConfigurationsection for more information about configuring your project.Getting StartedFirst, let's get some terminology out of the way. In Anki, aDeckcontains
one-to-manyNotes. One-to-manyCardsare created from eachNote.Notesare created from genericNote Types.Cardsare created from
genericCard Types.Note Typescontain one-to-manyCard Typesand
can be used across multipleDecks.See theAnki documentation (Key Concepts)for more information about the
various objects within Anki and how they relate to each other.In this guide, we'll be creating a very basic deck with a single note type and a
single card type. Please see theexamples/directory for more complicated
project structures, including multi-note-type and multi-card-type projects, as
well as multi-deck projects. The project we'll be building in this section is
listed underexamples/basicif you need to refer to it.Let's create a deck for memorizing the symbols of all of the elements on the
periodic table of elements. You can use thepanki create projectcommand to
generate a new project:$pankicreateprojectperiodic-tableThe project will be created under the directory name passed topanki create project, soperiodic-table/in this case. Please make sure that
this directory does not already exist - for safety reasons, panki will not
create the project if the directory already exists.After runningpanki create project, you should have aperiodic-table/directory with the following contents:periodic-table
├── data.csv
├── project.json
└── template.htmlTheproject.jsonfile contains all of the configuration for this project.
Panki uses this file to understand how your project is set up and how you'd like
the project to be built. The project configuration can also be split up among
multiple files if this file becomes too unwieldy - see theConfigurationsection for more information.The defaultproject.jsonshould look similar to the following (your IDs will
be different):{"name":"New Project","noteTypes":[{"id":1234567890123,"name":"Basic (panki)","fields":["Front","Back"],"cardTypes":[{"name":"Card","template":"template.html"}]}],"decks":[{"id":1234567890124,"name":"New Deck","package":"deck.apkg","notes":[{"type":"Basic (panki)","data":"data.csv"}]}]}Thedata.csvfile will eventually contain the data used to generate the deck's
notes. The defaultdata.csvfile is empty. A CSV file is generated by default,
but panki supports multiple data formats. If you would like to separate your
data across multiple files, that is also possible. See theNote Datasection
for more information.Thetemplate.htmlfile is the HTML template for a card type. Everything within
the<front>tag will be used for the front (or question) side of the card.
Likewise, everything within the<back>tag will be used for the back (or
answer) side of the card. You can customize the styling of the card by adding
custom CSS to the<style>tag of this template. If you would like to apply
common styling to more than just one card type, that is also possible. See theTemplates and Stylingsection for more information.The defaulttemplate.htmlfile is very similar to the Anki "Basic" template:<template><style>.card{font-family:arial;font-size:20px;text-align:center;color:black;background-color:white;}</style><front>{{Front}}</front><back>{{FrontSide}}<hrid="answer">{{Back}}</back></template>The default note type contains two fields:FrontandBack. If you look intemplate.html, you'll see placeholders for{{Front}}and{{Back}}respectively.For this project, we will create a custom note type instead of using the default
note type. Our note type will use the fieldElementfor the element name
(ex. Oxygen) andSymbolfor the element symbol (ex. O). Let's openproject.jsonand modify the note type accordingly. We'll also update the
project name and deck name to better describe this project.Yourproject.jsonfile should look something like this after these changes:{"name":"Periodic Table of Elements","noteTypes":[{"id":1234567890123,"name":"Element Symbol","fields":["Element","Symbol"],"cardTypes":[{"name":"Element Symbol","template":"template.html"}]}],"decks":[{"id":1234567890124,"name":"Element Symbols","package":"deck.apkg","notes":[{"type":"Element Symbol","data":"data.csv"}]}]}Now let's update ourtemplate.htmlfile to incorporate our new fields. We'll
even add some custom CSS to make the element symbol a bit more fancy.<template><style>.card{font-family:Arial;font-size:20px;text-align:center;color:black;background-color:white;}.symbol{font-size:1.5em;border:2pxsolidblack;padding:10px;}</style><front>What is the symbol for<b>{{Element}}</b>?</front><back>{{FrontSide}}<hrid="answer"><divclass="symbol">{{Symbol}}</div></back></template>Finally, let's add our data. You can copy the contents ofexamples/basic/data.csvinto yourdata.csvfile or add your own data.
Make sure that the header (first row) ofdata.csvcontains the field names
(ex.Element,Symbol) and that your data is in the same order (ex.Oxygen,O).We should now have everything we need to generate our deck. You can generate the
deck by running thepanki buildcommand from the project's root directory:$pankibuildBy default, the deck will be created atdeck.apkgin the root directory of
the project. You can change the name of the file and its location by modifying
the"package"value in the"deck"section of theproject.jsonfile.After building the project, you should be able to import the generateddeck.apkgfile into Anki using theImport Filebutton orFile>Menufrom the main menu.Warning: Please make sure you always backup your
collection (File>Export) before importing decks into Anki, especially if
you're updating an existing deck. If the import fails, or worse corrupts your
Anki database, then at least you will be able to restore your decks and progress
from the backup.Please refer to the rest of this readme for more advanced ways to use panki in
your deck building workflow.ScaffoldingYou can scaffold out new projects and new project components using thepanki createcommand.It is not required to use the scaffolding tool, of course - you could just
create all of the files and directories yourself if you know what you're doing -
but using the tool has several advantages. The scaffolding tool will ensure that
project files are created correctly. Commands to generate common project
structures can easily be shared with others. You can also build upon the
scaffolding commands by using them in your own tools and scripts.Project ScaffoldingTo create a new project, execute thepanki create projectcommand:$pankicreateproject<directory>Replace<directory>with the name of the new project directory. Make sure that
this directory does not exist before running this command. Panki will not create
the project if the directory already exists.You can set the name of the project by passing the--nameoption:$pankicreateprojectperiodic-table--name"Periodic Table of Elements"If you would like to package all of the decks in the project as a single.apkgfile, you can pass the--packageoption.$pankicreateprojectperiodic-table\--name"Periodic Table of Elements"\--package@/packages/periodic-table.apkgNote Type OptionsYou can set the name of a note type by passing the--note-typeoption:$pankicreateprojectperiodic-table--note-type"Element Symbol"You can create multiple note types by passing multiple--note-typeoptions:$pankicreateprojectperiodic-table\--note-type"Element Symbol"\--note-type"Element Atomic Number"\--note-type"Element Group"\--note-type"Element Block"You can pass the following additional options to further customize a note type:--note-type-config <note-type> <path>: Place the configuration for the
note type with name<note-type>outside ofproject.jsonin an external
file located at<path>.--fields <note-type> <fields>: Set the fields of the note type with
name<note-type>to the comma-separated list of<fields>(ex.Element,Symbol).--css <note-type> <paths>: Set the css files of the note type with
name<note-type>to the comma separated list of<paths>(ex.common.css,symbol.css)--card-type <note-type> <name> <template>: Add a card type to the note
type with name<note-type>with the provided card type<name>and<template>path. A minimal template file will be created at<template>.If no note types are provided, a "Basic (panki)" default note type is created.Deck OptionsYou can set the name of a deck by passing the--deckoption:$pankicreateprojectperiodic-table--deck"Element Symbols"This will also set the deck'spackagefield to a stripped-down version of the
deck name. You can change this value by providing the--deck-packageoption
(see below).You can create multiple decks by passing multiple--deckoptions:$pankicreateprojectperiodic-table\--deck"Element Symbols"\--deck"Element Atomic Numbers"\--deck"Element Groups"\--deck"Element Blocks"You can pass the following additional options to further customize the decks:--deck-config <deck> <path>: Place the deck configuration for the deck
with name<deck>outside ofproject.jsonin an external file at<path>.--deck-package <deck> <path>: Set the package path of the deck with
name<deck>to<path>. Make sure the path ends with.apkg.--notes <deck> <note-type> <data-files>: Add a group of notes to the
deck with name<deck>which are of type<note-type>and are created from
the data in the provided<data-files>list of paths. If you would like to
specify multiple data files, use a comma-separated list
(ex."data1.csv,data2.csv,data3.csv"). Empty data files will be created at
the provided paths.If no deck configuration is provided, an empty default deck is created.ExamplesThe following command will scaffold out a project structure in which each deck
is separated out into its own subdirectory. All of the decks are stored under adecks/directory, and each deck contains adeck.jsonfile with the deck's
configuration. Note data is also stored in the deck directory. All of the note
types are stored under anote-types/directory, and each note type contains anote-type.jsonfile with the note type's configuration. Card type templates
are also stored in the note type directory.$pankicreateprojectperiodic-table\\--name"Periodic Table of Elements"\--package@/packages/periodic-table.apkg\\--note-type-config"Element Symbol"note-types/symbol/note-type.json\--fields"Element Symbol"Element,Symbol\--css"Element Symbol"@/note-types/common.css,@/note-types/symbol.css\--card-type"Element Symbol"Forwardtemplate.forward.html\--card-type"Element Symbol"Reversetemplate.reverse.html\\--note-type-config"Element Atomic Number"note-types/atomic-number/note-type.json\--fields"Element Atomic Number"Element,AtomicNumber\--css"Element Atomic Number"@/note-types/common.css\--card-type"Element Atomic Number"Forwardtemplate.forward.html\--card-type"Element Atomic Number"Reversetemplate.reverse.html\\--note-type-config"Element Year Discovered"note-types/year-discovered/note-type.json\--fields"Element Year Discovered"Element,YearDiscovered\--css"Element Year Discovered"@/note-types/common.css\--card-type"Element Year Discovered"Forwardtemplate.forward.html\--card-type"Element Year Discovered"Reversetemplate.reverse.html\\--deck-config"Element Symbols"decks/symbols/deck.json\--deck-package"Element Symbols"@/packages/symbols.apkg\--notes"Element Symbols""Element Symbol"symbols.csv\\--deck-config"Element Atomic Numbers"decks/atomic-numbers/deck.json\--deck-package"Element Atomic Numbers"@/packages/atomic-numbers.apkg\--notes"Element Atomic Numbers""Element Atomic Number"atomic-numbers.csv\\--deck-config"Element Years Discovered"decks/years-discovered/deck.json\--deck-package"Element Years Discovered"@/packages/years-discovered.apkg\--notes"Element Years Discovered""Element Year Discovered"years-discovered.csvThe above command would create the following project structure:periodic-table/
├── decks
│   ├── atomic-numbers
│   │   ├── atomic-numbers.csv
│   │   └── deck.json
│   ├── symbols
│   │   ├── deck.json
│   │   └── symbols.csv
│   └── years-discovered
│       ├── deck.json
│       └── years-discovered.csv
├── note-types
│   ├── atomic-number
│   │   ├── note-type.json
│   │   ├── template.forward.html
│   │   └── template.reverse.html
│   ├── symbol
│   │   ├── note-type.json
│   │   ├── template.forward.html
│   │   └── template.reverse.html
│   └── year-discovered
│       ├── note-type.json
│       ├── template.forward.html
│       └── template.reverse.html
└── project.jsonThe following command will scaffold out an alternative project structure in
which all of the project configuration is stored inproject.jsonand adata/directory,templates/directory, andstyles/directory are used instead:$pankicreateprojectperiodic-table\\--name"Periodic Table of Elements"\--packagepackages/periodic-table.apkg\\--fields"Element Symbol"Element,Symbol\--css"Element Symbol"styles/common.css,styles/symbol.css\--card-type"Element Symbol"Forwardtemplates/symbol.forward.html\--card-type"Element Symbol"Reversetemplates/symbol.reverse.html\\--fields"Element Atomic Number"Element,AtomicNumber\--css"Element Atomic Number"styles/common.css\--card-type"Element Atomic Number"Forwardtemplates/atomic-number.forward.html\--card-type"Element Atomic Number"Reversetemplates/atomic-number.reverse.html\\--fields"Element Year Discovered"Element,YearDiscovered\--css"Element Year Discovered"styles/common.css\--card-type"Element Year Discovered"Forwardtemplates/year-discovered.forward.html\--card-type"Element Year Discovered"Reversetemplates/year-discovered.reverse.html\\--deck-package"Element Symbols"packages/symbols.apkg\--notes"Element Symbols""Element Symbol"data/symbols.csv\\--deck-package"Element Atomic Numbers"packages/atomic-numbers.apkg\--notes"Element Atomic Numbers""Element Atomic Number"data/atomic-numbers.csv\\--deck-package"Element Years Discovered"packages/years-discovered.apkg\--notes"Element Years Discovered""Element Year Discovered"data/years-discovered.csvThe above command would create the following project structure:periodic-table/
├── data
│   ├── atomic-numbers.csv
│   ├── symbols.csv
│   └── years-discovered.csv
├── project.json
└── templates
    ├── atomic-number.forward.html
    ├── atomic-number.reverse.html
    ├── symbol.forward.html
    ├── symbol.reverse.html
    ├── year-discovered.forward.html
    └── year-discovered.reverse.htmlConfigurationTheproject.jsonfile contains configuration for a panki project. It provides
panki with information about the project and the structure of its files. Sample
files and more information about each configuration item are provided below.Paths in configuration files are relative to the configuration file that the
path is in. If the path is prefixed with@/(ex.@/packages/deck.apkg), then
the path will always be relative to the project's root directory, regardless of
the directory that the configuration is in.Project ConfigurationTheproject.jsonfile from theGetting Startedsection is provided below.
This file defines a minimal panki project. All of the configuration is in a
single file, but these items can be split out into multiples files.{"name":"Periodic Table of Elements","noteTypes":[{"id":1234567890123,"name":"Element Symbol","fields":["Element","Symbol"],"cardTypes":[{"name":"Element Symbol","template":"template.html"}]}],"decks":[{"id":1234567890124,"name":"Element Symbols","package":"deck.apkg","notes":[{"type":"Element Symbol","data":"data.csv"}]}]}Thenamefield is the name of the project.ThenoteTypesfield contains a list of note type configurations for each note
type in the project. SeeNote Type Configurationfor more information.Thedecksfield contains a list of deck configurations for each deck in the
project. SeeDeck Configurationfor more information.The optionalpackagefield can also be provided. If provided, all of the decks
in the project will be combined into a single.apkgfile. Set the value of
this field to the path where the.apkgfile should be created.The optionalmediafield can also be provided. If provided, all of the files
in the directories specified will be copied to the Anki collection'scollection.media/directory, making them available to your decks. Set the
value of this field to a list of paths to your media directories. Only files
will be copied - directories will be ignored, as Anki does not supported media
subdirectories.Note Type ConfigurationNote type configuration can be split out from your project configuration into a
separate file by specifying the path to a note type configuration file:{"name":"Periodic Table of Elements",..."noteTypes":["note-type.json"]}In this case, we've specified that the note type configuration is located in a
file callednote-type.json, but the name of this file and its location are up
to you.A common pattern for projects with multiple note types is to create a directory
for each note type and place anote-type.jsonfile in each of those
directories. The project configuration for such a project might look like the
following:{"name":"Periodic Table of Elements",..."noteTypes":["note-types/symbol/note-type.json","note-types/atomic-number/note-type.json","note-types/year-discovered/note-type.json"]}Thenote-type.jsonfile would then contain just your note type configuration:{"id":1234567890123,"name":"Element Symbol","fields":["Element","Symbol"],"cardTypes":[{"name":"Element Symbol","template":"template.html"}]}Theidfield is automatically generated by panki. This value is used to
uniquely identify the note type within a user's Anki app and (as best as
possible) among all note types in existence. Once this value is set, it should
never be changed, otherwise there will be problems importing updated version of
the note type into Anki.If you need to generate an ID, you can use the following command:$pankicreateidThenamefield is the name of the note type as it will appear in Anki. This
name will also be used to link notes in note configuration to this note type.
If you change the name of a note type, be sure to update it in the rest of your
configuration. SeeNote Configurationfor more information.Thefieldsfield contains a list of the field names used by this note type.
These should match the field names in the respective note data files. Only the
fields specified infieldswill be selected from your note data files - all
other fields will be ignored.ThecardTypesfield contains a list of configurations for each card type in
the note type. SeeCard Type Configurationfor more information.Card Type ConfigurationCard type configuration can be split out from your note type configuration into
a separate file by specifying the path to a card type configuration file:{"name":"Element Symbol","fields":["Element","Symbol"],"cardTypes":["card-type.json"]}In this case, we've specified that the card type configuration is located in a
file calledcard-type.json, but the name of this file and its location are up
to you.Separating out card type configuration into a separate file is usually overkill,
even for large projects, but this functionality is available if required.Thecard-type.jsonfile would then contain just your card type configuration:{"name":"Element Symbol","template":"template.html"}Thenamefield is the name of the card type as it will appear in Anki.Thetemplatefield is the path to the HTML template file for the card type.
See theTemplates and Stylingsection for more information.Deck ConfigurationDeck configuration can be split out from your project configuration into a
separate file by specifying the path to a deck configuration file:{"name":"Periodic Table of Elements","decks":["deck.json"],...}In this case, we've specified that the deck configuration is located in a file
calleddeck.json, but the name of this file and its location are up to you.A common pattern for multi-deck projects is to create a directory for each deck
and place adeck.jsonfile in each directory. The project configuration for
such a project might look like the following:{"name":"Periodic Table of Elements","decks":["decks/symbols/deck.json","decks/atomic-numbers/deck.json","decks/years-discovered/deck.json"],...}Thedeck.jsonfile would then contain just your deck configuration:{"id":1234567890124,"name":"Element Symbols","package":"deck.apkg","notes":[{"type":"Element Symbol","data":"data.csv"}]}Theidfield is automatically generated by panki. This value is used to
uniquely identify the deck within a user's Anki app and (as best as possible)
among all decks in existence. Once this value is set, it should never be
changed, otherwise there will be problems importing updated version of the deck
into Anki.If you need to generate an ID, you can use the following command:$pankicreateidThenamefield is the name of the deck as it will appear in Anki. Remember
that you can create a deck tree by naming your decks with a::between the
parent deck name and the subdeck names.For example, all of the following subdecks would be nested under thePeriodic Tableparent deck in Anki:Periodic Table :: SymbolsPeriodic Table :: Atomic NumbersPeriodic Table :: GroupsPeriodic Table :: BlocksThepackagefield is the path of the file that will be generated when the
project is built withpanki build. This file should end with.apkg.Thenotesfield contains a list of note configurations for each group of notes
in the deck. See theNote Configurationsection for more information.Note ConfigurationNote configuration can be split out from your deck configuration into a separate
file by specifying the path to a note configuration file:{"id":1234567890124,"name":"Element Symbols","package":"deck.apkg","notes":["note.json"]}In this case, we've specified that the note configuration is located in a file
callednote.json, but the name of this file and its location are up to you.Separating out note configuration into a separate file is usually overkill, even
for large projects, but this functionality is available if required.Thenote.jsonfile would then contain just your note configuration:{"type":"Element Symbol","data":"data.csv"}Thetypefield is the name of the note type that the notes in this group will
be created from. Make sure you remember to change this value if the note type's
name ever changes, otherwise the notes will not be linked correctly.Thedatafield is the path to a note data file or a list of paths to several
note data files. Notes will be created and added to the deck in the order
specified in this field. See theNote Datasection for more information.The optionalguidfield can be specified to control the format of the note
GUID that will be created and assigned to the note. This field is often provided
if the default method of generating the GUID is not sufficient to guarantee the
uniqueness of a note. Note GUIDs prevent duplicate notes from being created in
certain cases and ensure that the correct notes are updated when importing
package files. They should be unique across all notes.By default, the note GUID is created by Base64-encoding the deck ID, the note
type ID, and the value of the first field specified in the note type
configuration'sfieldsfield. The GUID format should be specified in thepython string format syntax. All of the fields in the record are available.
The deck ID and the note type ID are also available from the special__DeckName__and__NoteTypeID__fields, respectively.For example, to specify the GUID format as a combination of the deck ID, note
type ID,Elementfield value, andSymbolfield value:{"type":"Element Symbol","guid":"{__DeckID__}:{__NoteTypeID__}:{Element}:{Symbol}","data":"data.csv"}The value created from this format will be Base64-encoded to create the final
note GUID.Note DataNote data can be provided in one or many CSV, JSON, and/or YAML files. The order
of the cards in the generated Anki deck will correspond to the order of the data
in your data files.CSV Data FilesFor CSV files, the header (first row) of the file should contain the field
names. These fields will be read from each row in the order specified, so make
sure that your data is in the same order as your field names.Example:Element,Symbol
Hydrogen,H
Helium,He
Lithium,Li
Beryllium,Be
Boron,B
Carbon,C
Nitrogen,N
Oxygen,O
Fluorine,F
Neon,Ne
...JSON/YAML Data FilesFor JSON and YAML files, the contents of the file should be a list and each
item in the list should be an object. Each of these objects should have keys
corresponding to the note field names.JSON Example:[{"Element":"Hydrogen","Symbol":"H"},{"Element":"Helium","Symbol":"He"},{"Element":"Lithium","Symbol":"Li"},{"Element":"Beryllium","Symbol":"Be"},{"Element":"Boron","Symbol":"B"},{"Element":"Carbon","Symbol":"C"},{"Element":"Nitrogen","Symbol":"N"},{"Element":"Oxygen","Symbol":"O"},{"Element":"Fluorine","Symbol":"F"},{"Element":"Neon","Symbol":"Ne"},...]YAML Example:# Elements in period 1:-Element:HydrogenSymbol:H-Element:HeliumSymbol:He# Elements in period 2:-Element:LithiumSymbol:Li-Element:BerylliumSymbol:Be-Element:BoronSymbol:B-Element:CarbonSymbol:C-Element:NitrogenSymbol:N-Element:OxygenSymbol:O-Element:FluorineSymbol:F-Element:NeonSymbol:Ne# ...An advantage of using YAML for your note data is that you can include comments
within your data file. A disadvantage of the YAML and JSON formats is that they
are not as compact as CSV files, but this may be an acceptable tradeoff,
depending on how you manage your data. The deck generated from the data will be
the same size, regardless of the format of your data files.Multiple Data FilesYou can choose to organize your data across multiple data files if this makes
sense for organizational purposes. You may also wish to segment your data in
order to better control the ordering of the cards in your deck, especially when
your cards are generated from multiple note types.Sticking with the periodic table of elements theme, you may wish to segment
elements by period and store all of your data files in adata/directory. In
this case, your note configuration might look like the following:{"type":"Element Symbol","data":["data/period1.csv","data/period2.json","data/period3.yaml",...],...}If you have multiple decks in a project, they usually have their own data files,
but there's nothing stopping you from using the same data file for each deck or
sharing a core set of data files between several decks if this makes sense for
your project. If you are using a data file multiple times within the same deck,
you will likely need to set theguidfield in the deck's note configuration to
another pattern in order to avoid creating duplicate cards. See theNote Configurationsection for more information.Remember that you can use other tools and scripts alongside panki. If your data
requires extra processing or a conversion process, you can perform that step
just prior to generating a deck.Templates and StylingTemplates define the structure and style of a card type. Note types contain
one-to-many card types from which cards are generated. Note types can be shared
across multiple decks.The default panki template looks like this:<template><style>.card{font-family:arial;font-size:20px;text-align:center;color:black;background-color:white;}</style><front>{{Front}}</front><back>{{FrontSide}}<hrid="answer">{{Back}}</back></template>Templates must contain a root element,<template>, and a<front>and<back>element nested under this root element. You can also provide the
optional<style>element under the root element.In Anki, CSS is assigned to a note type, so the CSS applies to all card types
defined in the note type. The CSS provided in the<style>tag of each card
type template will be merged together in the order specified in the note type
configuration in order to create the final CSS for the note type.If there is common CSS that you'd like to place outside of your individual
templates, you can provide the optional"css"field in your note type
configuration with a path or list of paths to external.cssfiles. The CSS in
these files will be merged together in the order specified and then the CSS from
the<style>elements of the card type templates will be appended to create the
final CSS for the note type.For example, if you store your common CSS in acommon.cssfile, your note type
configuration might look something like this:{"id":1234567890123,"name":"Element Symbol","fields":["Element","Symbol"],"css":"common.css","cardTypes":[{"name":"Element Symbol","template":"template.forward.html"},{"name":"Element Symbol (Reverse)","template":"template.reverse.html"}]}You can also specify multiple stylesheets and refer to the project root
directory with the@/path prefix:{"id":1234567890123,"name":"Element Symbol","fields":["Element","Symbol"],"css":["@/styles/common.css","@/styles/symbol.css"],"cardTypes":[{"name":"Element Symbol","template":"template.forward.html"},{"name":"Element Symbol (Reverse)","template":"template.reverse.html"}]}See theAnki documentation (Card Templates)for more information about
templates and styling.Working with Anki Collectionspanki provides a few extra commands for working with Anki collections directly.
You might use these commands to take a closer look at the contents of a package
file, as part a more complicated build process, or to make changes to an Anki
package manually whether it be to fix something or for some other reason.Dumping Package FilesIt can be very useful to dump the contents of an Anki.apkgor.colpkgfile
into a more convenient format for inspection or for further processing. Panki
provides the ability to dump the contents of a package with thepanki dumpcommand:$pankidump<package><directory>Replace<package>with the path to the.apkgor.colpkgfile that you'd
like to dump.Replace<directory>with the path to the directory that you'd like panki to
dump the contents of the package into. This directory should not already exist.After runningpanki dump, the directory will contain acollection.anki2file
that you can connect to with SQLite3:$sqlite3path/to/collection.anki2Atables/directory will also be created, containing a folder for each
database table in thecollection.anki2file. In each folder, panki will create
atable.jsonfile with metadata about the table, aschema.sqlfile with the
table schema in the form of a SQLCREATEcommand, and arows.csvfile with
the rows of the table in CSV format, if applicable.Seepanki dump -hfor more information.Exporting Anki CollectionsYou can export an Anki collection (collection.anki2) into an Anki package
(.apkgor.colpkg) using thepanki exportcommand:$pankiexportpath/to/collection.anki2path/to/package.colpkgIf you'd like to only export a specific deck from the collection, you can
specify the deck ID using the--deckoption:$ panki export path/to/collection.anki2 path/to/package.apkg \
      --deck 1234567890123Seepanki export -hfor more information.LicenseThis project is licensed under theMIT License. Please see theLICENSEfile for more information.This project is not affiliated with theAnkiproject.