badlydrawnrob / anki

Learn to code with Anki — flashcards and themes for all learning levels. Master your programming language of choice!
MIT License
719 stars 61 forks source link

`npm run pandoc` for Anki Card's data (and design tradeoffs) #98

Closed badlydrawnrob closed 2 months ago

badlydrawnrob commented 8 months ago

Compiling Markdown for your cards:

For short snippets of Markdown, use code.html;

  • themes/cards/missing/missing.md or /simple/simple.md are preferred for viewing in browser.
  • However, themes/cards/*/*-stripped.md files are quicker to view/copy code.

In the root folder you can npm run pandoc or npm run Pandoc-stripped.

Unfortunately Safari doesn't show the nice unicode icons (like ) without -standalone flag. This is because Safari has latin1 formatting as standard over the more common UTF-8.

Possible solutions

Best case scenario is to cut down the HTML code as much as possible.

  1. [x] Go back to what we had before, and deal with the garbled output?
  2. [x] Try and remove the header css from the HTML template header (link to main.css instead)
  3. [x] Use the browser and inspect element each section to copy/paste ...
  4. [x] Or just use your favourite text editor to preview once compiled.

Markdown options

Why?

Safari still defaults to (Western ISO Latin 1) charset

If Safari doesn't have the correct <meta> values, with content wrapped in a <body>, the unicode characters (stars etc) will be garbled (like the closed issue linked to above)

<html>
  <head>
      <meta charset="utf-8">
  </head>
  <body>
      /* content */
  </body>
</html>

Seems like this is a known frustratingly annoyingly stupid Safari bug that can be changed in browser preferences, but might have to be fixed with the above method (not raw html without the wrapping)

Oh what fun it is to code for the web 🤬

badlydrawnrob commented 8 months ago

Coding for browsers is a clusterfuck

Screenshot 2024-01-13 at 22 22 27 Screenshot 2024-01-13 at 22 38 30
badlydrawnrob commented 8 months ago

Marked as hard because it's part of the advanced documentation

badlydrawnrob commented 7 months ago

Even the HTML view fucks up ★ unicode characters the in the inspector:

Screenshot 2024-01-18 at 15 31 53