gregorias / anki-code-highlighter

Anki plugin for code syntax highlighting.
GNU Affero General Public License v3.0
54 stars 3 forks source link

I can't set the default highlighter. #66

Closed jesmarti closed 8 months ago

jesmarti commented 8 months ago

I can't set the default highlighter Setting a default highlighter causes the highlighter not to work at all. I wonder if I'm doing anything wrong...

Reproduction steps image

  1. Add this line of code in the config window. "default-highlighter": "pygments"

When saving changes and returning to the config page, the code is automatically reordered: image

  1. Refresh the assets.

Expected behavior I expected the default highlighter's choice to appear as default. However, when attempting to highlight code by using the shortcut or by clicking on the icon, the addon doesn't respond ezgif-5-cd1801d17a

Card Template Front:

{{Front}}

<!-- Anki Code Highlighter (Addon 112228974) BEGIN -->
<link rel="stylesheet" href="_ch-pygments-solarized.css" class="anki-code-highlighter">
<link rel="stylesheet" href="_ch-hljs-solarized.css" class="anki-code-highlighter">
<script src="_ch-highlight.js" class="anki-code-highlighter"></script>
<script src="_ch-my-highlight.js" class="anki-code-highlighter"></script>
<!-- Anki Code Highlighter (Addon 112228974) END -->

Back:

{{FrontSide}}

<hr id=answer>

{{Back}}

<!-- Anki Code Highlighter (Addon 112228974) BEGIN -->
<link rel="stylesheet" href="_ch-pygments-solarized.css" class="anki-code-highlighter">
<link rel="stylesheet" href="_ch-hljs-solarized.css" class="anki-code-highlighter">
<script src="_ch-highlight.js" class="anki-code-highlighter"></script>
<script src="_ch-my-highlight.js" class="anki-code-highlighter"></script>
<!-- Anki Code Highlighter (Addon 112228974) END -->

Styling:

.card {
    font-family: arial;
    font-size: 20px;
    text-align: center;
    color: black;
    background-color: white;
}

Additional information

gregorias commented 8 months ago

Thank you for your detailed report. I can reproduce the issue and am taking a look.

gregorias commented 8 months ago

I found the issue, I should be able to fix it within 24h.