GithubHelp home page GithubHelp logo

anki_style's Introduction

anki_style

A live version of anki_style can be seen here: https://tnahs.github.io/anki_style/

anki_style is a standardized style sheet I've developed over the past year or so while using Anki while learning French. It by no means is an exhaustive set of classes for all situations but it covers the basic cards for when learning a language. Namely reviewing: vocabulary, sentences, and conversations. However, most of these classes, if not all, can also be used with any type of card, it's not limited to either languages or specific topics.

The aim was to have a way to flexibly format and re-format my cards. Removing almost all HTML and CSS from Anki ensures that I can change/edit/tweak the color palette or overall theme without having to sift through thousands of cards.

Installation

Required: anki_style.css

Optional: Roboto Slab from Google Fonts


  1. Copy anki_style.css, bullet_sq.gif and peek_bg.png to your collections.media folder.

Note: Make sure to add a leading underscore _ to the filename. Because the style sheet is not explicitly referenced in any fields, Anki will see it as un-used media when Tools>Check Media is run. By adding a leading underscore Anki ignores the file when checking media.

Thus: _anki_style.css, _bullet_sq.gif and _peek_bg.png will be in your collections.media folder.

The collections.media is located:

On Windows, the latest Anki versions store your Anki files in your appdata folder. You can access it by opening the file manager, and typing %APPDATA%\Anki2 in the location field. Older versions of Anki stored your Anki files in a folder called Anki in your Documents folder.

On Mac computers, recent Anki versions store all their files in the ~/Library/Application Support/Anki2 folder. The Library folder is hidden by default, but can be revealed in Finder by holding down the option key while clicking on the Go menu. If you’re on an older Anki version, your Anki files will be in your Documents/Anki folder.

On Linux, recent Anki versions store your data in ~/.local/share/Anki2, or $XDG_DATA_HOME/Anki2 if you have set a custom data path. Older versions of Anki stored your files in ~/Documents/Anki or ~/Anki.

https://apps.ankiweb.net/docs/manual.html#files


  1. Add @import 'anki_style.css'; to the Styling section of your note.

  1. In the Front Template or Back Template of your Card Types window:
  • Create a div <div></div>
  • Add a class attribute <div class=""></div>
  • Assign a specific class from the list below. <div class="box header hcolor"></div>

  1. Download Roboto Slab and install using the method of your specific OS. https://apps.ankiweb.net/docs/manual.html#installing-fonts

Classes

box:

<div class="box">{{field}}</div>

as_0000_box1 as_0001_box2

Using an unordered list:

<ul>
  <li>This is how I format...</li>
  <li>multiple definitions.</li>
</ul>

as_0002_box3

Adding type:

  <ul>
	<li class=type>This li.type class is used...</li>
	<li>as a separator in case...</li>
	<li>a word has multiple forms.</li>
	<li class=type>noun</li>
	<li>noun definition 1</li>
	<li>noun definition 2</li>
	<li class=type>adjective</li>
	<li>adjective definition 1</li>
	<li>adjective definition 2</li>
  </ul>

as_0002_box3


question box:

<div class="box question">{{field}}</div>

as_0003_box-question

For example: <div class="box question">{{Quesion}}</div> and a saved search such as: Question:*_* can be setup to return all cards with something in the {{Quesion}} field. I find it handy to compile a bunch of questions to ask a native speaker, or do research on at a later time.


peek box:

<div class="box peek">{{field}}</div>

This takes any box class and makes the inner text invisible until a hover. It makes cards "three-sided." A sentence translation can be revealed on the back template only after someone has hovered over the box. For example, with a listening card, the back of a card can be revealed to confirm what was heard in the target language without revealing the translation.

as_0007_peek as_0008_revealed1 as_0009_revealed2 as_0010_revealed3


pic box:

<div class="box pic">{{field}}</div>

The pic class auto-resizes an image to fit within the bounds of the div and styles it to match the rest of the aesthetic.

as_0004_box-header


header box:

<div class="box header">{{field}}</div>

as_0004_box-header


header box colored:

<div class="box header hcolor">{{field}}</div>
<div class="box header hgray">{{field}}</div>

This is a purely aesthetic adjustment to the top border color of the header class.

as_0005_box-header-hcolor as_0006_box-header-hgray


conversation box:

<div class="box conversation">{{field}}</div>

This is used only for conversation cards. Fonts are styled smaller along with some minor aesthetic adjustments.

as_0011_conversation


tag box:

<div class="box tags"># {{field}}</div>

Faintly displays the current tags.

Note: Actual style does not have outline.

as_0012_tag


hidden: Field contents are not rendered on card. Primarily used in two cases. Hide text that's being fed to AwesomeTTS and hide text being fed to a javascript function. In these cases I usually use a <span></span> instead of a <div></div>.

<span class="hidden">{{field}}</span>

Example

Note: This first example assumes the use of AwesomeTTS and a group of voices names "FrenchVoices" to generate on-the-fly audio for listening comprehension. See AwesomeTTS Documentation for more on this.

<!-- Front Template -->

<div class="box header hcolor">Écoute:</div>
{{^Audio}}<tts class="hidden" group="FrenchVoices">{{Phrase}}</tts>{{/Audio}}
{{#Audio}}{{Audio}}{{/Audio}}
<!-- Styling (shared between cards) -->

@import '_anki_style.css';
<!-- Back Template -->

<div class="box header hcolor">{{Phrase}}</div>
{{#Anglais}}<div class="box peek">{{Anglais}}</div>{{/Anglais}}
{{#Notes}}<div class="box">{{Notes}}</div>{{/Notes}}
{{#Question!}}<div class="box question">{{Question!}}</div>{{/Question!}}
{{#Tags}}<div class="box tags"># {{Tags}}</div>{{/Tags}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.