gregorias / anki-code-highlighter

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

No colors in the default styles #71

Closed consal closed 7 months ago

consal commented 7 months ago

Bug description Using the plugin with default styles or any other styles results in no style being applied.

Reproduction steps Steps to reproduce the behavior:

  1. Install the plugin
  2. Format a code snippet
  3. Only the font changes, no colors are applied.

The HTML of the test card:

<div class="pygments" style="display:flex; justify-content:center;">
<pre><code class="nohighlight"><span class="k">def</span> <span class="nf">main</span><span class="p">():</span>
    <span class="k">pass</span>
</code></pre>
</div>

Expected behavior Styling should be applied.

Screenshots obraz

Card template Back template

{{FrontSide}}

<hr id=answer>

{{Tył}}

<!-- 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 -->

Additional information

Additional context I tried

gregorias commented 7 months ago

Could you fill out the bug template? Could you refresh the plugin?

consal commented 7 months ago

Hi, sure I'll fill it tomorrow.

I tried now: Delete Code Highlighter Assets -> Restart -> Delete the plugin -> Restart -> Install the plugin -> Restart.

It's still the same, no styling.

consal commented 7 months ago

I updated the issue with the bug template

gregorias commented 7 months ago

Thank you for the details.

Could you provide a screenshot of the card's preview? Styles through CSS classes are not applied in the edit mode, so what you've presented so far is expected.

image

consal commented 7 months ago

Lol, it works now! I was learning before filling the bug request, and there was no formatting. After filling the bug request, suddenly formatting works in all my cards. I have no idea what fixed it. Must've been one action I did when filling the report. Opening HTML view? Opening card template and saving it again? No idea. I also tested now with different card templates, it worked in all of them.

(By the way, the screenshot I took yesterday and had in the originally opened issue with no formatting was from learning card, not from editing view.)

I couldn't solve it for months, I have hundreds of cards using this extension, and finally I can see some colors! <3 Thanks for your help!

obraz

gregorias commented 7 months ago

It might have been the act of refreshing assets.