Skip to content

Latest commit

 

History

History
110 lines (68 loc) · 5.44 KB

README.md

File metadata and controls

110 lines (68 loc) · 5.44 KB

This add-on adds the following supplementary formatting buttons to Anki:

  • a code button that will wrap selected text in a <code> (shortcut: Ctrl + ,). You can specify the CSS class you want to use in combination with <code>. For example, we have a CSS class named c defined in the Styling section of Cards:

      .c {
          font-family: droid sans mono;
          background-color: #f2f2f2;
          padding-left: 5px;
          padding-right: 5px;
      }
    

    In the options Tools > Supplementary buttons add-on (options) > Alter <code> CSS... we can specify the class name, so that our <code> elements will be automatically transformed to <code class="c">.

  • an unordered list button (shortcut Ctrl + [):

    • One
    • Two
    • Three
  • an ordered list button (shortcut Ctrl + ]):

    1. One
    2. Two
    3. Three
  • an indent button (shortcut Ctrl + Shift + ]) to indent text or lists:

    1. One
      • Two
        1. Three
  • an outdent button (shortcut Ctrl + Shift + [) to outdent text or lists

  • a strikethrough button (shortcut Alt + Shift + 5):

    strikethrough text example

  • a code block button (shortcut Ctrl + .) that creates a <pre> block element around the selected element. This works the same way the code button works. You can specify the CSS class you want to use in combination with <pre> by going to Tools > Supplementary buttons add-on (options) > Alter <code> CSS...

  • a horizontal rule button (shortcut Ctrl + H) that inserts a horizontal rule after the current position of the cursor

  • a definition list button (shortcut Ctrl + Shift + D):

    definition term
    definition description

    Upon clicking the button, a popup will appear where you can enter your terms and descriptions.

  • a table button (shortcut Ctrl + Shift + 3):

    header header
    content content

    Select the text you want to create a table from. This works very much the same as a Markdown list:

      header1 | header2
      -|-
      elem1 | elem2
    

    This will create a list with two columns and two rows. The -|- part is optional, but can be used to align the column to the left (:-), right (-:) or to the center (:-:). You can skip this line completely, but do make sure you add a pipe character | between elements to designate a border.

    Alternatively, if you do not select any text, upon clicking the Create a table button you will be presented with a dialog window asking you to specify the number of rows and columns.

  • a keyboard key button (shortcut Ctrl + Shift + K):

    This will create a keyboard key, for example Esc. By itself, the text that is wrapped in <kbd> will not look any different from the rest of the text. You have to style it first by going to the Styling section of Cards and add CSS to your liking. For example:

      kbd {
          box-shadow: inset 0px 1px 0px 0px #ffffff;
          background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f9f9f9), color-stop(1, #e9e9e9) );
          background-color: #f9f9f9;
          border-radius: 5px;
          border: 1px solid #dcdcdc;
          display: inline-block;
          font-size: 0.8em;
          height: 30px;
          line-height: 30px;
          padding: 0px 10px;
          text-align: center;
          text-shadow: 1px 1px 0px #ffffff;
      }
    
  • a hyperlink button (shortcut Ctrl + Shift + H):

    Upon pressing the button, you will be presented with a dialog window where you can enter both a link and text. To unlink a hyperlink, use the unlink button.

  • a text highlight button (shortcut Ctrl + Shift + N to select color, Ctrl + Shift + B to apply it):

    Highlight your text with any color you would like.

  • a blockquote button (shortcut Ctrl + Shift + Y):

    Cite your source distinctively from the rest of the text.

    Do not pray for easy lives. Pray to be stronger men.

  • alignment buttons:

    Align your text left, right, center or justified. Shortcuts are Ctrl + Shift + Alt + L, R, B and J, respectively.

  • a heading button (shortcut Ctrl + Alt + 1):

    You can either create a heading by prepending text with hashes: # for a <h1> heading, ###### for a <h6> heading. If you do not prepend any hashes, or if you select no text at all, a dialog will appear where you can create your own heading.

The buttons can be enabled or disabled individually in Tools > Supplementary buttons add-on (options), so feel free to disable the buttons you don't use.

To add this add-on to Anki, copy the file extra_buttons.py to your Anki add-on folder. On Linux,this is $HOME/Anki/addon by default, or you can go to the Anki add-on site and install the add-on from there (preferred).