Skip to content

Compile Options (TODO)

Just like runtime options, compile options are also options that are applied globally to each JPMN card.

The difference between runtime options and compile options is that compile options require you to build the note on your machine to use. Runtime options can be accessed and changed without having to build the note.


Accessing & Editing

To access the compile options, build the note.

After building the note, a new file config/config.py should appear. The compile options can be found in this file.

To use these compile options, edit the config.py file, and then re-build the note.

Warning

Do not edit the config/example_config.py file. The example config file can be updated at any time, so if you update the example config through git, it may result in unnecessary merge conflicts.


Always filled & Never filled fields

Using compile options, one can set a field to act as if it has always been filled, or it has never been filled, using the always-filled-fields and never-filled-fields options. This will remove the conditional Anki templates ({{#FIELD}} and {{^FIELD}} markers) for the specified fields.

Example

If your compile-options is:

"compile-options": {
    ...
    "always-filled-fields": ["A"],
    "never-filled-fields": ["B"],
    ...
}

and your card template is:

{{#A}} A is filled {{/A}}
{{^A}} A is not filled {{/A}}
{{#B}} B is filled {{/B}}
{{^B}} B is not filled {{/B}}
{{#C}} C is filled {{/C}}
{{^C}} C is not filled {{/C}}

then upon card build, the resulting card template will be:

A is filled
B is not filled
{{#C}} C is filled {{/C}}
{{^C}} C is not filled {{/C}}

This usually renders the actual field value useless. In other words, filling the field for a note will have no effect on the cards.

Warning

Do not delete the field from the fields list! See here for more details.


Optimized Vocab Card Example

An example set of compile options to create a more optimized vocab card is shown below.

Vocab card compile options example

"compile-options": {
    "keybinds-enabled": False,

    "hardcoded-runtime-options": True,

    "always-filled-fields": [],

    "never-filled-fields": [
        "PAShowInfo", "PATestOnlyWord", "PADoNotTest",
        "PASeparateWordCard", "PASeparateSentenceCard", "AltDisplayPASentenceCard",
        "SeparateClozeDeletionCard",
        "IsClickCard", "IsHoverCard", "IsSentenceCard", "IsTargetedSentenceCard",
    ],

    "enabled-modules": [
        # HIGHLY RECOMMENDED to have this enabled if you want a nice looking card
        # (unless you are not using images in your cards of course)
        "img-utils-minimal",
    ],
}


Last update: June 17, 2023