Anki text wrap problem when editing notes (Anking med school deck)

I am trying to put additional notes into my Anking deck (desktop), but there is a problem with text wrapping. There are random breaks and my sentences don’t run across the screen.

When I don’t use bullet points, the sentences run across fine but when I use bullet points, they have random breaks. It’s as if there is some textbox barrier that isn’t letting the sentences run across the screen normally.

What I have tried:

At first I thought the problem occurred because I was pasting the notes from a google document. However, I tried manually typing notes into the Anking card with Anki’s indentation button for bullet points but the problem still persists. However, when I created a test card (not within the Anking deck), the problem doesn’t seem to occur.

Any guidance would be very much appreciated.

Images are attached.
Anking card via browse: how the notes appear on when I view via browse
Anking card via preview: how the notes appear on preview
Anking card HTML editor: figured I would attach this too, if it helps
Test card non-anking: the problem does not appear on a non Anking-deck card




Your html in the field looks alright.

I’m guessing it’s something in the template – I could look at it but would need the css and html for that. If you do provide it, please put them into code blocks because this site otherwise eats some important formatting. Like this:

```
Some code goes here
```

1 Like

Thank you for being open to helping out. I am not familiar with coding at all, is this what you were asking for?

<ul style="font-weight: 700;"><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Strep pyogenes virulence factors</span></div></li><ul><li><div><span style="color: rgb(0, 144, 106);">Strep pyrogenic exotoxin (SPE)</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Scarlet fever</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Red and swollen tongue (strawberry tongue), pharyngitis, widespread rash that spares the face</span></div></li></ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Toxic shock-like syndrome (TSLS)</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Mediated by a superantigen → SpeA and SpeC</span></div></li></ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Necrotizing fasciitis</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Caused by toxigenic strains of Strep pyogenes</span></div></li><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Mediated by a superantigen → SpeB</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Mnemonic → B for burnt − the skin looks burnt</span></div></li></ul></ul></ul><li><div><span style="color: rgb(0, 144, 106);">Streptolysin O</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">We generate AB’s to streptolysin O → ASO AB’s</span></div></li><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Can get an ASO titer to check if person has recently had a GAS infection</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Only group A strep has an ASO response because ASO is an antibody specifically targeted against a toxin produced by GAS</span></div></li></ul></ul><li><div><span style="color: rgb(0, 144, 106);">Streptokinase</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Converts plasminogen to plasmin</span></div></li><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Plasmin is fibrinolytic → streptokinase is given to lyse clots during an MI</span></div></li></ul><li><div><span style="color: rgb(0, 144, 106);">M-protein</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Interferes with opsonization = antiphagocytic</span></div></li><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Very antigenic → elicits strong humoral response → more likely to make antibodies against self antigens (myosin in cardiac muscle)</span></div></li><ul><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">This process is called molecular mimicry → M mimics</span></div></li><li><div><span style="font-weight: 400; color: rgb(0, 144, 106);">Rheumatic fever affects the mitral valves (stenosis)</span></div></li></ul></ul></ul></ul>
1 Like

Sorry, I should have linked the docs. I mean this: Card Templates - Anki Manual.

(the html in your field works fine)

1 Like

Ah, got it.

These are the blocks I found specific to the “extra” sections:

#1

<!-- Extra field -->
{{#Extra}}<p></p>
<div id="extra">{{edit:Extra}}</div>
<br>{{/Extra}}

#2

{{#Sketchy Extra}}
<span id = "hint-sketchyextra" class="hintBtn" data-name="Sketchy Extra">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-sketchyextra')"></a>
  <button id="button-sketchyextra" class="button-general" onclick="toggleHintBtn('hint-sketchyextra')">
    <img src="_sketchy.icon.png"> Sketchy Extra
  </button>
  <div id="sketchyextra" class="hints" style="display: none;">{{edit:Sketchy Extra}}</div>
</span>
{{/Sketchy Extra}}

And the following is the whole thing I copied:

<script>
// ##############  HINT REVEAL SHORTCUTS  ##############
// All shortcuts will also open with "H" if using the Hint Hotkeys add-on 
var ButtonShortcuts = {
    "Lecture Notes" : "Alt+1",
    "Missed Questions" : "Alt+2",
    "Pathoma" : "Alt+3",
    "Boards and Beyond" : "Alt+4",
    "First Aid" : "Alt+5",
    "Sketchy" : "Alt+6",
    "Sketchy 2": "",
    "Sketchy Extra": "",
    "Picmonic": "",
    "Pixorize" : "Alt+7",
    "Physeo" : "Alt+8",
    "Bootcamp" : "Alt+F2",
    "OME" : "Alt+F1",
    "Additional Resources" : "Alt+9",
}
var ToggleAllButtonsShortcut = "'"
var ToggleNextButtonShortcut = "H";
// ##############  SHOW HINTS AUTOMATICALLY  ##############
var ButtonAutoReveal = {
    "Lecture Notes" : false,
    "Missed Questions" : false,
    "Pathoma" : false,
    "Boards and Beyond" : false,
    "First Aid" : false,
    "Sketchy" : false,
    "Sketchy 2": false,
    "Sketchy Extra": false,
    "Picmonic": false,
    "Pixorize" : false,
    "Physeo" : false,
    "Bootcamp" : false,
    "OME" : false, // not currently a button
    "Additional Resources" : false,
}

var ScrollToButton = true;

// ##############  TAG SHORTCUT  ##############
var toggleTagsShortcut = "C";

// ENTER THE TAG TERM WHICH, WHEN PRESENT, WILL TRIGGER A RED BACKGROUND
var tagID = "XXXYYYZZZ"

// WHETHER THE WHOLE TAG OR ONLY THE LAST PART SHOULD BE SHOWN

var numTagLevelsToShow = 0;

// ##############  CLOZE ONE BY ONE  ##############
var revealNextShortcut = "N" 
var revealNextWordShortcut = "Shift+N"
var toggleAllShortcut = ","

// Changes how "Reveal Next" and clicking behaves. Either "cloze" or "word".
// "word" reveals word by word. 
var revealNextClozeMode = "cloze" 

// What cloze is hidden with
var clozeHider = (elem) => "👑"
/* 
You can replace the above line with below examples. '█' or '_' works well for hiding clozes.

// Fixed length:
var clozeHider = (elem) => "███"
// Replace each character with "█":
var clozeHider = (elem) => "█".repeat(elem.textContent.length)
// Show whitespaces:
var clozeHider = (elem) => "[" + elem.textContent.split(" ").map((t) => "█".repeat(t.length)).join(" ") + "]"
// Color-filled box (doesn't hide images):
var clozeHider = (elem) => `<span style="background-color: red; color: transparent;">${elem.innerHTML}</span>`
*/

</script>


<div class="clozefield" id="text">{{cloze:Text}}</div>

<!-- ##############  EDIT CLOZE DURING REVIEW  ##############
			-change below (not above) to  "edit:cloze:Text" for editable field, 
				but be sure to have the correct add-on installed-->

<div class="editcloze" id="text">{{edit:cloze:Text}}</div>


<br>

<!-- ##############  TEXT-TO-SPEECH ##############
replace the arrows/dashes from the statement below with double curly brackets-->

<!--tts en_US voices=Apple_Samantha speed=1.4:cloze-only:Text-->


<hr>

<!-- BUTTON FIELDS -->
<!-- ClOZE ONE BY ONE BUTTONS -->

<div id="one-by-one" style="display: none;">{{One by one}}</div>

<div id="1by1-btns" style="display: none;">
  <button id="button-reveal-next" class="button-general" onclick="revealNextCloze()">Reveal Next</button>
  <button id="button-toggle-all" class="button-general" onclick="toggleAllCloze()">Toggle All</button>
</div>

<script>
  (() => {
    let clozeOneByOneEnabled = true;
      clozeOneByOneEnabled = document.getElementById("one-by-one").textContent !== "";
    
    if (clozeOneByOneEnabled) {
      document.getElementById("1by1-btns").style.display = "block";
    }
    })()
  </script>

<!-- OME AUTO OPEN FIELD -->
<div class="banner-ome">{{#OME}}{{OME}}{{/OME}}</div>

<!-- BUTTON FIELDS -->
{{#Lecture Notes}}
<span id = "hint-ln" class="hintBtn" data-name="Lecture Notes">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-ln')"></a>
  <button id="button-ln" class="button-general" onclick="toggleHintBtn('hint-ln')">
    <img src="_Anking_v3.png"> Lecture Notes
  </button>
  <div id="notes" class="hints" style="display: none;">{{edit:Lecture Notes}}</div>
</span>
{{/Lecture Notes}}

{{#Missed Questions}}
<span id = "hint-mq" class="hintBtn" data-name="Missed Questions">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-mq')"></a>
  <button id="button-mq" class="button-general" onclick="toggleHintBtn('hint-mq')">
    <img src="_Anking_v3.png"> Missed Questions
  </button>
  <div id="missed" class="hints" style="display: none;">{{edit:Missed Questions}}</div>
</span>
{{/Missed Questions}}

{{#Pathoma}}
<span id = "hint-pat" class="hintBtn" data-name="Pathoma">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-pat')"></a>
  <button id="button-pat" class="button-general" onclick="toggleHintBtn('hint-pat')">
    <img src="_pathoma.icon.png"> 
  </button>
  <div id="pathoma" class="hints" style="display: none;">{{edit:Pathoma}}</div>
</span>
{{/Pathoma}}

{{#Boards and Beyond}}
<span id = "hint-bb" class="hintBtn" data-name="Boards and Beyond">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-bb')"></a>
  <button id="button-bb" class="button-general" onclick="toggleHintBtn('hint-bb')">
    <img src="_b&b.icon.png"> Boards and Beyond
  </button>
  <div id="bnb" class="hints" style="display: none;">{{edit:Boards and Beyond}}</div>
</span>
{{/Boards and Beyond}}


<!-- Extra field -->
{{#Extra}}<p></p>
<div id="extra">{{edit:Extra}}</div>
<br>{{/Extra}}

{{#First Aid}}
<span id = "hint-fa" class="hintBtn" data-name="First Aid">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-fa')"></a>
  <button id="button-fa" class="button-general" onclick="toggleHintBtn('hint-fa')">
    <img src="_first-aid.icon_v2.1.png"> First Aid
  </button>
  <div id="firstaid" class="hints" style="display: none;">{{edit:First Aid}}</div>
</span>
{{/First Aid}}

{{#Sketchy}}
<span id = "hint-sketchy" class="hintBtn" data-name="Sketchy">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-sketchy')"></a>
  <button id="button-sketchy" class="button-general" onclick="toggleHintBtn('hint-sketchy')">
    <img src="_sketchy.icon.png"> Sketchy
  </button>
  <div id="sketchy" class="hints" style="display: none;">{{edit:Sketchy}}</div>
</span>
{{/Sketchy}}

{{#Sketchy 2}}
<span id = "hint-sketchy2" class="hintBtn" data-name="Sketchy 2">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-sketchy2')"></a>
  <button id="button-sketchy2" class="button-general" onclick="toggleHintBtn('hint-sketchy2')">
    <img src="_sketchy.icon.png"> Sketchy 2
  </button>
  <div id="sketchy2" class="hints" style="display: none;">{{edit:Sketchy 2}}</div>
</span>
{{/Sketchy 2}}

{{#Sketchy Extra}}
<span id = "hint-sketchyextra" class="hintBtn" data-name="Sketchy Extra">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-sketchyextra')"></a>
  <button id="button-sketchyextra" class="button-general" onclick="toggleHintBtn('hint-sketchyextra')">
    <img src="_sketchy.icon.png"> Sketchy Extra
  </button>
  <div id="sketchyextra" class="hints" style="display: none;">{{edit:Sketchy Extra}}</div>
</span>
{{/Sketchy Extra}}

{{#Picmonic}}
<span id = "hint-picmonic" class="hintBtn" data-name="Picmonic">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-picmonic')"></a>
  <button id="button-picmonic" class="button-general" onclick="toggleHintBtn('hint-picmonic')">
    <img src="_picmonic.icon.png"> Picmonic
  </button>
  <div id="picmonic" class="hints" style="display: none;">{{edit:Picmonic}}</div>
</span>
{{/Picmonic}}

{{#Pixorize}}
<span id = "hint-pixorize" class="hintBtn" data-name="Pixorize">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-pixorize')"></a>
  <button id="button-pixorize" class="button-general" onclick="toggleHintBtn('hint-pixorize')">
    <img src="_pixorize.png"> Pixorize
  </button>
  <div id="pixorize" class="hints" style="display: none;">{{edit:Pixorize}}</div>
</span>
{{/Pixorize}}

<!--{{#Physeo}}
<span id = "hint-physeo" class="hintBtn" data-name="Physeo">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-physeo')"></a>
  <button id="button-physeo" class="button-general" onclick="toggleHintBtn('hint-physeo')">
    <img src="_physeologo.icon.png"> 
  </button>
  <div id="physeo" class="hints" style="display: none;">{{edit:Physeo}}</div>
</span>
{{/Physeo}}

{{#Bootcamp}}
<span id = "hint-bootcamp" class="hintBtn" data-name="Bootcamp">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-bootcamp')"></a>
  <button id="button-bootcamp" class="button-general" onclick="toggleHintBtn('hint-bootcamp')">
    <img src="_bootcamp.png"> Bootcamp
  </button>
  <div id="bootcamp" class="hints" style="display: none;">{{edit:Bootcamp}}</div>
</span>
{{/Bootcamp}}


<!-- OME FIELD (only shows on mobile)-->
{{#OME}}
<span id = "hint-ome" class="hintBtn" data-name="OME">
  <a onclick="toggleHintBtn('hint-ome')"></a>
  <button id="button-ome" class="button-general" onclick="toggleHintBtn('hint-ome')">
    <img src="_omelogo.icon.png"> OnlineMedEd
  </button>
  <div id="ome" class="hints" style="display: none;">{{edit:OME}}</div>
</span>
{{/OME}}

{{#Additional Resources}}
<!--<span id = "hint-ar" class="hintBtn" data-name="Additional Resources">
  <a href="#" class="hint" onclick="toggleHintBtn('hint-ar')"></a>
  <button id="button-ar" class="button-general" onclick="toggleHintBtn('hint-ar')">
    <img src="_Anking_v3.png"> Additional Resources
  </button>
  <div id="additional" class="hints" style="display: none;">{{edit:Additional Resources}}</div>
</span>
{{/Additional Resources}}


<!-- ANKING HYPERLINK IMAGE -->
<a href="https://www.ankingmed.com"><img src="_AnKingRound.png" alt="The AnKing" id="pic"></a>

<!-- NOT-PERSISTING EVENT LISTENER -->
<script>
  if (window.ankingEventListeners) {
    for (const listener of ankingEventListeners) {
      const type = listener[0]
      const handler = listener[1]
      document.removeEventListener(type, handler)
    }
  }
  window.ankingEventListeners = []
  
  window.ankingAddEventListener = function(type, handler) {
    document.addEventListener(type, handler)
    window.ankingEventListeners.push([type, handler])
  }
</script>

<!-- Shortcut Matcher Function -->
<script>
  var specialCharCodes = {
    "-": "minus",
    "=": "equal",
    "[": "bracketleft",
    "]": "bracketright",
    ";": "semicolon",
    "'": "quote",
    "`": "backquote",
    "\\": "backslash",
    ",": "comma",
    ".": "period",
    "/": "slash",
  };
  // Returns function that match keyboard event to see if it matches given shortcut.
  function shortcutMatcher(shortcut) {
    let shortcutKeys = shortcut.toLowerCase().split(/[+]/).map(key => key.trim())
    let mainKey = shortcutKeys[shortcutKeys.length - 1]
    if (mainKey.length === 1) {
      if (/\d/.test(mainKey)) {
        mainKey = "digit" + mainKey
      } else if (/[a-zA-Z]/.test(mainKey)) {
        mainKey = "key" + mainKey
      } else {
        let code = specialCharCodes[mainKey];
        if (code) {
          mainKey = code
        }
      }
    }
    let ctrl = shortcutKeys.includes("ctrl")
    let shift = shortcutKeys.includes("shift")
    let alt = shortcutKeys.includes("alt")

    let matchShortcut = function (ctrl, shift, alt, mainKey, event) {
      if (mainKey !== event.code.toLowerCase()) return false
      if (ctrl !== (event.ctrlKey || event.metaKey)) return false
      if (shift !== event.shiftKey) return false
      if (alt !== event.altKey) return false
      return true
    }.bind(window, ctrl, shift, alt, mainKey)
    
    return matchShortcut
  }
</script>

<!-- HINT BUTTONS SETUP -->
<script>
    (function() {
      window.toggleHintBtn = function(containerId, noScrolling=false) {
        const container = document.getElementById(containerId)
        const link = container.getElementsByTagName("a")[0]
        const button = container.getElementsByTagName("button")[0]
        const hint = container.getElementsByTagName("div")[0]
    
        if (hint.style.display == "none") {
          button.classList.add("expanded-button")
          hint.style.display = "block"
          link.style.display = "none"
          if (ScrollToButton && !noScrolling) {
            hint.scrollIntoView({
              behavior: "smooth", // "auto" for instant scrolling
              block: "start",
              inline: "nearest"
            });
          }
        } else {
          button.classList.remove("expanded-button")
          hint.style.display = "none"
          link.style.display = ""
        }
      }

      window.toggleNextButton = function(){
        // adapted from Hint Hotkey add-on
        var customEvent = document.createEvent('MouseEvents');
        customEvent.initEvent('click', false, true);
        var arr = document.getElementsByTagName('a');
        for (var i=0; i<arr.length; i++) {
          var el = arr[i];
          if (el.style.display === 'none') {
            continue;
          }
          if (el.classList.contains("hint")) {
            el.dispatchEvent(customEvent);
            break
          }
        }
      }
        
      const isToggleNextShortcut = shortcutMatcher(ToggleNextButtonShortcut)
      ankingAddEventListener("keydown", (evt) => {
        if (evt.repeat) return
        if (isToggleNextShortcut(evt)) {
          toggleNextButton()
        }
      })
    
      const setupHintBtn = function(elem) {
        const containerId = elem.id
        const fieldName = elem.dataset.name
        const button = elem.getElementsByClassName("button")[0]
        
        if (ButtonAutoReveal[fieldName]) {
          toggleHintBtn(containerId, noScrolling=true)
        }
    
        const isShortcut = shortcutMatcher(ButtonShortcuts[fieldName])
        const isToggleAllShortcut = shortcutMatcher(ToggleAllButtonsShortcut)
        ankingAddEventListener("keydown", (evt) => {
          if (evt.repeat) return
          if (isShortcut(evt) || isToggleAllShortcut(evt)) {
            toggleHintBtn(containerId)
          }
        })
      }
    
      const hints = document.getElementsByClassName("hintBtn")
      for (let i = 0; i < hints.length; i++) {
        setupHintBtn(hints[i])
      }
    })()
    </script>

<!-- AUTOFLIP BACK SCRIPT -->
<script>
    // autoflip hides card in front template
    document.getElementById("qa").style.removeProperty("display")
</script>

<!-- CLOZE ONE BY ONE SCRIPT -->
<style>
  .cloze[data-content]:hover {
    cursor: pointer;
  }
  .cloze[data-hint] {
    color: #009400 !important;
  }
</style>

<script>
  (function() {
    var clozeOneByOneEnabled = true;
      clozeOneByOneEnabled = document.getElementById("one-by-one").textContent !== "";

    if (!clozeOneByOneEnabled) {
      return
    }
    
    const revealCloze = function(elem) {
      // Checking for dataset.content is undefined may not be needed anymore?
      if (elem.dataset.content === undefined) {
        return
      }
      elem.innerHTML = elem.dataset.content
      rerunMathJax()

      delete elem.dataset.content
      delete elem.dataset.hint
    }

    const revealClozeWord = function(elem) {
      if (elem.dataset.content === undefined) {
        return
      }
      if (elem.dataset.hidden !== undefined) {
        let words = elem.dataset.hidden.split(" ");
        if (words.length == 1) {
          revealCloze(elem)
          delete elem.dataset.hidden
          delete elem.dataset.revealed
        } else {
          elem.dataset.revealed = elem.dataset.revealed + " " + words[0]
          elem.dataset.hidden = words.slice(1).join(" ");
          let temp = document.createElement("div");
          temp.innerHTML = elem.dataset.hidden;
          elem.innerHTML = elem.dataset.revealed + " " + clozeHider(temp);
          delete elem.dataset.hint
        }
      } else {
        let temp = document.createElement("div");
        temp.innerHTML = elem.dataset.content;
        elem.dataset.hidden = temp.textContent;
        elem.dataset.revealed = "";
        revealClozeWord(elem)
      }
      rerunMathJax()
    }

    window.revealNextCloze = function() {
      let nextHidden = document.querySelector(".cloze[data-content]")
      if(!nextHidden) {
          return
      } 
      if (revealNextClozeMode === "word") {
          revealClozeWord(nextHidden)
      } else {
          revealCloze(nextHidden)
      }
    }

    const hideAllCloze = function(initial) {
      let clozes = document.getElementsByClassName("cloze")
      let count = 0 // hidden cloze count
      for (let i = 0; i < clozes.length; i++) {
        let cloze = clozes[i]
        if (cloze.offsetWidth === 0) {
          continue
        }
        cloze.dataset.content = cloze.innerHTML
        if(window.clozeHints && window.clozeHints[count]) {
          cloze.innerHTML = window.clozeHints[count]
          cloze.dataset.hint = true
        } else {
          cloze.innerHTML = clozeHider(cloze)
        }
        count += 1
        if (initial === true) {
          cloze.addEventListener("touchend", revealClozeClicked)
          cloze.addEventListener("click", revealClozeClicked)
        }
      }
    }

    window.toggleAllCloze = function() {
      let elems = document.querySelectorAll(".cloze[data-content]")
      let button = document.getElementById("button-toggle-all")
      if(elems.length > 0) {
        for (let i = 0; i < elems.length; i++) {
            revealCloze(elems[i])
        }
      } else {
        hideAllCloze(initial=false)
      }
    }

    const revealClozeClicked = function(ev) {
      let elem = ev.currentTarget
      if (elem.dataset.content === undefined) {
        return
      }
      if (!ev.altKey && (revealNextClozeMode !== "word")) {
        revealCloze(elem)
      } else {
        revealClozeWord(elem)
      }
      ev.stopPropagation()
      ev.preventDefault()
    }      

    const rerunMathJax = function() {
      // rerun mathjax on the document so that the cloze text gets formatted
      // ... for MathJax 2
      try {
          MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
      } catch {}
      // ... for MathJax 3     
      try {
          MathJax.typesetPromise()
      } catch {}
    }
    
    hideAllCloze(initial=true)

    let isShowNextShortcut = shortcutMatcher(window.revealNextShortcut)
    let isShowWordShortcut = shortcutMatcher(window.revealNextWordShortcut)
    let isToggleAllShortcut = shortcutMatcher(window.toggleAllShortcut)
    ankingAddEventListener("keydown", (ev) => {
      let next = isShowNextShortcut(ev)
      let word = isShowWordShortcut(ev)
      let all = isToggleAllShortcut(ev)
      if (next || word) {
        let elem = document.querySelector(".cloze[data-content]")
        if (elem) {
          if (next) {
            revealCloze(elem)
          } else {
            revealClozeWord(elem)
          }
          ev.stopPropagation()
          ev.preventDefault()
        }
      } else if (all) {
        toggleAllCloze()
        ev.stopPropagation()
        ev.preventDefault()
      }
    });
  })()
</script>

<!-- CLICKABLE COLORFUL TAGS -->
{{#Tags}}
<div id="tags-container">{{clickable::Tags}}</div>
<script>
  var tagContainer = document.getElementById("tags-container")
  if (tagContainer.childElementCount == 0) {
    var tagList = tagContainer.innerHTML.split(" ");
    var kbdList = [];
    var newTagContent = document.createElement("div");

    for (var i = 0; i < tagList.length; i++) {
      var newTag = document.createElement("kbd");
      var tag = tagList[i];
      // numTagLevelsToShow == 0 means the whole tag should be shown
      if(numTagLevelsToShow != 0){
        tag = tag.split('::').slice(-numTagLevelsToShow).join("::");
      }
      newTag.innerHTML = tag;
      newTagContent.append(newTag)
    }
    tagContainer.innerHTML = newTagContent.innerHTML;
    tagContainer.style.cursor = "default";
  }
  if (tagContainer.innerHTML.indexOf(tagID) != -1) {
    tagContainer.style.backgroundColor = "rgba(251,11,11,.15)";
  }

  function showtags() {
    var tagContainerShortcut = document.getElementById("tags-container");

    if (tagContainerShortcut.style.display
      === "none") {
      tagContainerShortcut.style.display = "block";
    } else {
      tagContainerShortcut.style.display =
        "none";
    }
  }
  
  var isShortcut = shortcutMatcher(toggleTagsShortcut)
  ankingAddEventListener('keyup', function (e) {
      if (isShortcut(e)) {
          showtags();
      }
  });

</script>
{{/Tags}}

<!-- WIKIPEDIA SEARCHES -->
<div id="popup-container">
  <button id="close-popup-btn" onclick="closePopup(true)">&times;</button>
  <a id="open-wiki-btn" href="">&#8618;</a>
  <div id="tc"></div>
  <div id="fadebottom_v"></div>
  <div id="ic"><img id="popup-image"></div>
</div>
<style>
  #tc {
    color: #222222;
    position: absolute;
    top: 16px;
    margin: 0px;
    left: 15px;
    text-decoration: none;
    height: 320px;
    overflow: hidden;
    overflow-y: scroll;
    white-space: pre-wrap;
    width: 300px;
  }
  
  #tc p {
    margin: 0px;
  }
  
  #tc::-webkit-scrollbar {
    display: none;
  }
  
  #fadebottom_v {
    height: 30px;
    width: 300px;
    background: -webkit-linear-gradient(270deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 1));
    z-index: 111;
    position: absolute;
    bottom: 0px;
    left: 15px;
  }
  
  #hc {
    color: #666;
    font-weight: bold;
  }
  
  #ic {
    right: 0px;
    top: 30px;
    position: absolute;
  }
  
  #ic img {
    width: 160px;
    height: auto;
    object-fit: cover;
    overflow: hidden;
  }
  
  #popup-image {
    width: 140px;
    height: auto;
  }
  
  #popup-container {
    background: #fff;
    position: absolute;
    bottom: 30px;
    right: 10px;
    z-index: 110;
    -webkit-box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px 1px rgba(0, 0, 0, 0.05);
    box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px 1px rgba(0, 0, 0, 0.05);
    padding: 0;
    display: none;
    font-size: 17px;
    line-height: 20px;
    border-radius: 2px;
    width: 480px;
    height: 340px;
    overflow: hidden;
    font-family: Arial;
    text-align: left;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
  }
  
  #close-popup-btn {
    position: absolute;
    top: 1px;
    right: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: 0;
    cursor: pointer;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 20px;
    outline: none;
    text-align: right;
    z-index: 112;
  }
  
  #open-wiki-btn {
    position: absolute;
    top: 10px;
    right: 30px;
    width: 15px;
    height: 32px;
    background: none;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    color: #222222;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 17px;
    outline: none;
    text-align: left;
    z-index: 112;
  }
</style>

<script>
  function getSummaryFor(word) {
    word = word.replace(/^[\.,\/#\!$%\^&\*;:{}=\-_`~() \'\s]+|[\.,\/#\!$%\^&\*;:{}=\-_`~()\'\s]+$/g, "");
    var pc = document.getElementById("popup-container");
    var hc = document.getElementById("hc");
    var tc = document.getElementById("tc");
    var ic = document.getElementById("ic");
    var imgelem = document.getElementById("popup-image");
    imgelem.src = "";
    var shortsum = "";
    
    fetch("https://en.wikipedia.org/api/rest_v1/page/summary/" + word)
    .then(function (response) { return response.json(); })
    .then(function (response) {
      shortsum = response.description;
      shortsum = shortsum.replace(/(Disambiguation.*)/g, "Disambiguation");
      tc.innerHTML = "<span id='hc'>" + capfl(shortsum) + "</span>" + "\n" + response.extract_html + "\n";
      tc.style.width = "420px";
      if (response.extract_html && !response.extract.endsWith("to:")) {
        pc.style.display = "block";
        document.getElementById("open-wiki-btn").href = response.content_urls.desktop.page;
      } else { 
        pc.style.display = "none"; 
      }
      if (!response.thumbnail.source || response.type === "disambiguation") {
        tc.style.width = "420px";
      } else { 
        tc.style.width = "300px"; imgelem.src = response.thumbnail.source; 
      }
    })
    .catch(function (error) { 
      console.log(error); 
    });
  }
  
  function closePopup(deselectAlso = false) {
    pcc.style.display = 'none';
    if (deselectAlso) { clearSelection(); }
  }

  var pcc = document.getElementById("popup-container");
  var prevSel = "";
  ankingAddEventListener('click', function () {
    var currentSelection = getSelectionText();
    if (currentSelection !== "") { prevSel = currentSelection; }
    if (currentSelection && !mustClickW) {
      getSummaryFor(currentSelection);
    } else { closePopup(); }
  });

  ankingAddEventListener('keyup', function (e) {
    if (e.key == "w") {
      if (pcc.style.display === "block") { closePopup(); } else { getSummaryFor(prevSel); }
    }
  });

  function getSelectionText() {
    var text = "";
    if (window.getSelection) {
      text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange().text; }
    return text;
  }

  function capfl(s) {
    return s.charAt(0).toUpperCase() + s.slice(1);
  }

  function clearSelection() {
    if (window.getSelection) { window.getSelection().removeAllRanges(); }
    else if (document.selection) { document.selection.empty(); }
  }
  
  //CUSTOMIZATION
  //this is a variable controlling whether user must click the "w" key to open the popup.
  //if set to true: user must select text, then click the "w" key to open wikipedia popup. Clicking "w" key again will close the popup. 
  //if set to false: user only needs to select text. popup will open automatically. Clicking "w" is an alternative but not obligatory way of opening/closing the popup in this mode.
  //BELOW SET to true or to false. 
  var mustClickW = true;
  //END CUSTOMIZATION
</script>


<!-- BEGIN ANKIHUB MODFICATIONS --><br><br>
<!--{{#ankihub_id}}
<a class='ankihub' href='https://app.ankihub.net/decks/notes/{{ankihub_id}}'>
View Note on AnkiHub
</a>
{{/ankihub_id}}
<br><!-- END ANKIHUB MODFICATIONS -->
1 Like

This thing is much bigger than expected. Goes to show that I do not have to worry about performance with my own templates, considering Ankings template is much more complex and seems to work fine for their users.

Anyways, back to this topic: I’m especially interessted in the css. Can you find the styling for (at least) p and extra and paste them here?

1 Like

This is what I found with respect to styling for the extra section:

/*################  USER CUSTOMIZATION END  ################
###########################################################*/

/* Styling For Whole Card*/
.card {
  text-align: center;
  font-size: 1rem;
  height: 100%;
  margin: 0px 15px;
  flex-grow: 1;
  padding-bottom: 1em;
  margin-top: 15px;
}
.mobile .card {
  padding-bottom: 5em;
  margin: 1ex .3px;
}

/* Style the horizontal line */
hr { opacity: .7 }

/* Formatting For Timer */
.timer {
  font-size: 20px;
  margin: 12em auto auto auto;
}


/* ~~~~~~~~~ FIELDS ~~~~~~~~~ */
/* Cloze format */
.cloze {
  font-weight: bold;
}

/* Adjustments For Cloze Edit In Review On Mobile */
.clozefield,
.mobile .editcloze {
  display: none;
}
.editcloze,
.mobile .clozefield {
  display: block;
}

/* Text When Hint Is Shown*/
.hints {
  font-style: italic;
}

/*add spacing between hints and extra field*/
.hints+#extra {
  margin-top: 1rem; 
}

/* Extra Field */
#extra {
  font-style: italic;
  font-size: 1rem;
}

And this is the whole thing:

/*    ANKINGOVERHAUL   */

/* The AnKing wishes you the best of luck! Be sure to check out our YouTube channel and Instagram
 for all things Anki and Med School related (including how to customize this card type and use these decks):  
		www.AnKingMed.com
			@ankingmed    			
*/

/*#########################################################
################  USER CUSTOMIZATION START  ##############*/
/* You can choose colors at www.htmlcolorcodes.com */

/* TIMER ON/OFF */
.timer {
  display: none; /* ‘none’ or ‘block’ */
}

/* TAGS ON/OFF DESKTOP & MOBILE*/
#tags-container {
  display: none; /* ‘none’ or ‘block’ */
}

.mobile #tags-container {
  display: none; /* ‘none’ or ‘block’ */
}

/* MOVE TAGS UP FOR 'NO-DISTRACTIONS' ADD-ON */
#tags-container {
  padding-bottom: 0px; /* 0 normal, 55 to move up */
}


/*~~~~~~~~~FONT SIZE~~~~~~~~~*/
/*NOTE: anything with 'px' will keep a font that size indefinitely, 
'rem' is a fraction of this size above and allows all text to change size with the above setting */
/* Desktop */
html {
  font-size: 28px;
}
/* Mobile */
.mobile {
  font-size: 28px;
}

/*IPAD ADJUSTMENTS (currently not applied)
.ipad .card,
.ipad #extra {
  font-size: 28px;
}
.ipad .hints {
  font-size: 24px;
}
.ipad #firstaid,
.ipad #sketchy,
.ipad #sketchy2,
.ipad #sketchyextra,
.ipad #picmonic,
.ipad #pixorize,
.ipad #physeo,
.ipad #additional {
  font-size: 20px !important;
}
*/

/*REVEALED HINTS FONT SIZE*/
.hints {
  font-size: .85rem;
}

/*Other Fields Font Size*/
#firstaid,
#sketchy,
#sketchy2,
#sketchyextra,
#picmonic,
#pixorize,
#physeo,
#additional {
  font-size: .6rem !important;
}

/*Other Fields Font Size on Mobile*/
.mobile #firstaid,
.mobile #sketchy,
.mobile #sketchy2,
.mobile #sketchyextra,
.mobile #picmonic,
.mobile #pixorize,
.mobile #physeo,
.mobile #additional {
  font-size: 20px !important;
}

/*~~~~~~~~~FONT STYLE~~~~~~~~~*/
.card,
kbd {
  font-family: Arial Greek, Arial; /*Step exam's font is Arial Greek*/
}

/*~~~~~~~MAX IMAGE HEIGHT/WIDTH~~~~~~~*/
img {
  max-width: 85%;
  max-height: 100%;
}

#extra img,
#notes img,
#missed img,
#pathoma img,
#bnb img {
  max-width: 85%;
}

#firstaid img,
#sketchy img,
#sketchy2 img,
#sketchyextra img,
#picmonic img,
#pixorize img,
#physeo img,
#additional img {
  max-width: 60%;
}


/*~~~~~~~~~COLORS~~~~~~~~~/
/* Default Text Color */
.card {
  color: black;
}
/* Background Color */
.card {
  background-color: #D1CFCE;
}
/* Cloze Color */
.cloze {
  color: blue;
}
/* "Extra" Field Color */
#extra {
  color: navy;
}
/* Hint Reveal Color */
.hints {
  color: #4297F9;
}
/* Missed Questions Hint Reveal Color */
#missed {
  color: red;
}
/* Timer Countdown Color */
.timer {
  color: transparent;
}
/* Empty Link Color */
a:not([href]),
a[href^="javascript:"] {
  text-decoration: none;
  color: inherit;
}


/*~~~~~~~~NIGHT MODE COLORS~~~~~~~~*/
/* NM Default Text Color */
.nightMode.card,
.night_mode .card {
  color: #FFFAFA !important;
}
/* NM Background Color */
.nightMode.card,
.night_mode .card {
  background-color: #272828 !important;
}
/* NM Cloze Color */
.nightMode .cloze,
.night_mode .cloze {
  color: #4297F9 !important;
}
/* NM "Extra" Field Color */
.nightMode #extra,
.night_mode #extra {
  color: magenta;
}
/* NM Hint Reveal Color */
.nightMode .hints,
.night_mode .hints {
  color: cyan;
}


/* ~~~~~COLOR ACCENTS FOR BOLD-ITALICS-UNDERLINE~~~~~~*/
b {
  color: inherit;
}

u {
  color: inherit;
}

i {
  color: inherit;
}

/*################  USER CUSTOMIZATION END  ################
###########################################################*/

/* Styling For Whole Card*/
.card {
  text-align: center;
  font-size: 1rem;
  height: 100%;
  margin: 0px 15px;
  flex-grow: 1;
  padding-bottom: 1em;
  margin-top: 15px;
}
.mobile .card {
  padding-bottom: 5em;
  margin: 1ex .3px;
}

/* Style the horizontal line */
hr { opacity: .7 }

/* Formatting For Timer */
.timer {
  font-size: 20px;
  margin: 12em auto auto auto;
}


/* ~~~~~~~~~ FIELDS ~~~~~~~~~ */
/* Cloze format */
.cloze {
  font-weight: bold;
}

/* Adjustments For Cloze Edit In Review On Mobile */
.clozefield,
.mobile .editcloze {
  display: none;
}
.editcloze,
.mobile .clozefield {
  display: block;
}

/* Text When Hint Is Shown*/
.hints {
  font-style: italic;
}

/*add spacing between hints and extra field*/
.hints+#extra {
  margin-top: 1rem; 
}

/* Extra Field */
#extra {
  font-style: italic;
  font-size: 1rem;
}


/* ~~~~~~~~~DETAILS FOR IMAGES~~~~~~~~~ */
.mobile .card img {
  max-width: 100% !important;
}
#extra img {
  min-width: 30%;
}

.mobile .hints, .mobile #extra img {
  max-width: 100% !important;
}

/* Classes for individual cards */
.image40 img { width: 40% !important;}
.image50 img { width: 50% !important;}
.image60 img { width: 60% !important;}
.image70 img { width: 70% !important;}
.image80 img { width: 80% !important;}
.image90 img { width: 90% !important;}

.image40 img,
.image50 img,
.image60 img,
.image70 img,
.image80 img,
.image90 img {
  display: block;
  margin-right: auto;
  margin-left: auto;
}

.mobile .image40 img,
.mobile .image50 img,
.mobile .image60 img,
.mobile .image70 img,
.mobile .image80 img,
.mobile .image90 img {
  width: auto !important;
}

/*Image hover zoom*/
#extra img:active,
#notes img:active,
#missed img:active,
#pathoma img:active,
#bnb img:active {
  transform: scale(1.2);
}

#firstaid img:active,
#sketchy img:active,
#sketchy2 img:active,
#sketchyextra img:active,
#picmonic img:active,
#pixorize img:active,
#physeo img:active,
#additional img:active {
  transform: scale(1.5);
}

.mobile img:active {
  transform: scale(1.0) !important;
}


/* ~~~~~~~MNEMONICS LEFT JUSTIFIED~~~~~~~ */
.mnemonics {
  display: inline-block;
  text-align: left; /* can change to center to 'turn off' this feature */
}
.centerbox {
  text-align: center;
}


/* ~~~~~~~~~ LISTS ~~~~~~~~~ */
ul {
  padding-left: 40px;
  display: inline-block;
  max-width: 50%;
  margin: auto;
  text-align: left;
}
ol {
  padding-left: 40px;
  display: inline-block;
  max-width: 50%;
  margin: auto;
  text-align: left;
}
.mobile ul {
  display: inline-block;
  text-align: left; 
  max-width: 100%;
}
.mobile ol {
  display: inline-block;
  text-align: left; 
  max-width: 100%;
}


/* ~~~~~~~~~ ADD-ON CONFIGURATIONS ~~~~~~~~~ */
/*Compatibility with Image Style Editor add-on*/
.card {
  --w: 0%;
}
.mobile .card {
  --w: 100% !important;
}

/*Max image width for resize images in editor add-on */
.card [class^=ui-] img {
  max-width: 100% !important;
}

/*Compatibility with resize images in editor add-on */
.resizer {
  min-width: 0% !important;
}
.mobile .resizer {
  min-width: 100% !important;
}

/* Fix to make pop-up dictionary images the right size */
.qtip img {
  max-width: 95% !important;
  max-height: 95% !important;
}


/* ~~~~~~ANKING HYPERLINK IMAGE~~~~~~ */
#pic {
  opacity: 0.0;
  font-size: 16px;
  font-family: Comic Sans !important;
  font-style: bold;
  height: 50px;
  border: 0;
  position: fixed;
  bottom: 10px;
  right: 10px;
  display: block;
}

#pic:hover {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.mobile #pic {
  display: none;
}

/* ~~~~~~~~~ TAGS ~~~~~~~~~ */
/* Container To Fix Tags At Bottom Of Screen */
#tags-container {
  position: fixed;
  bottom: .5px;
  width: 100%;
  line-height: .75rem;
  margin-left: -15px;
  background-color: transparent;
}


/* Clickable Tags (need to download the add-on) */
kbd {
  display: inline-block;
  letter-spacing: .1px;
  font-weight: bold;
  font-size: 20px !important;
  text-shadow: none !important;
  padding: 0.05rem 0.1rem !important;
  margin: 1px !important;
  border-radius: 4px;
  border-width: 1.5px !important;
  border-style: solid;
  background-color: transparent !important;
  box-shadow: none !important;
  opacity: 0.5;
  vertical-align: middle !important;
  line-height: auto !important;
  height: auto !important;
}

/* Tag Becomes More Visible On Hover */
kbd:hover {
  opacity: 1;
  transition: opacity 0.2s ease;
}

/* Tag Colors */
kbd:nth-of-type(1n+0) { border-color: #F44336; color: #F44336!important; }
kbd:nth-of-type(2n+0) { border-color: #9C27B0; color: #9C27B0!important; }
kbd:nth-of-type(3n+0) { border-color: #3F51B5; color: #3F51B5!important; }
kbd:nth-of-type(4n+0) { border-color: #03A9F4; color: #03A9F4!important; }
kbd:nth-of-type(5n+0) { border-color: #009688; color: #009688!important; }
kbd:nth-of-type(6n+0) { border-color: #C0CA33; color: #C0CA33!important; }
kbd:nth-of-type(7n+0) { border-color: #FF9800; color: #FF9800!important;}
kbd:nth-of-type(8n+0) { border-color: #FF5722; color: #FF5722!important; }
kbd:nth-of-type(9n+0) { border-color: #9E9E9E; color: #9E9E9E!important; }
kbd:nth-of-type(10n+0) { border-color: #607D8B; color: #607D8B!important; }

/* Tag Mobile Adjustments */
.mobile kbd {
  opacity: .9;
  margin: 1px !important;
  display: inline-block;
  font-size: 10px !important;
}
.mobile #tags-container {
  line-height: 0.6rem;
  margin-left: 0px;
}


/* OME BANNER */
.banner-ome {
  max-width: 300px;
  display: none;
  margin-left: auto;
  margin-right: auto;
}
.mobile .banner-ome {
  display: none;
}

#button-ome {
  display: none;
}
.mobile #button-ome {
  display: inline;
}


/* ~~~~~~~~~BUTTON LAYOUT~~~~~~~~~ */
.button-general {
  outline: 0;
  border-radius: 0.12em;
  border: 1px solid #525253 !important;
  padding: 5px 5px;
  text-align: center;
  display: inline-block;
  font-size: 9.5px;
  background-color: #424242;
  color: #AFAFAF !important;
  margin-top: 8px;
}

.mobile .button-general {
  font-size: 18px;
  padding: 9px 7px;
}

.expanded-button {
  display: block;
  margin: auto;
  margin-top: 10px;
  font-weight: bold;
  width: 50% !important;
  background: #ababab !important;
  color: black !important;
  font-weight: bold;
  width: 50% !important;
}


#button-mq:not(.expanded-button) {
  color: #c26165 !important;
}


html:not(.mobile) .button-general:hover {
  cursor: default;
  background-color: #E9E9E9 !important;
  color: #363638 !important;
}

html:not(.mobile) #button-mq:hover {
  background-color: #FA8072 !important;
  color: black !important;
}

html:not(.mobile) #button-pat:hover {
  background-color: #EABCE4 !important;
}

html:not(.mobile) #button-fa:hover {
  background-color: #FFF1B8 !important;
}

html:not(.mobile) #button-sketchy:hover {
  background-color: #7EDEC0 !important;
}

html:not(.mobile) #button-pixorize:hover {
  background-color: #ea8eed !important;
}

html:not(.mobile) #button-physeo:hover {
  background-color: #A1C0C6 !important;
}

html:not(.mobile) #button-bootcamp:hover {
  background-color: #0b8198 !important;
}

html:not(.mobile) #button-ome:hover {
  background-color: #47C3F3 !important;
}
1 Like

Additionally, this the styling for the normal “non anking” test card I made, in case it helps compare anything.

.card {
    font-family: arial;
    font-size: 20px;
    text-align: center;
    color: black;
    background-color: white;
}
.cloze {
    font-weight: bold;
    color: blue;
}
.nightMode .cloze {
    color: lightblue;
}

What you’re seeing is caused by this:

/* ~~~~~~~~~ LISTS ~~~~~~~~~ */
ul {
  padding-left: 40px;
  display: inline-block;
  max-width: 50%;
  margin: auto;
  text-align: left;
}
ol {
  padding-left: 40px;
  display: inline-block;
  max-width: 50%;
  margin: auto;
  text-align: left;
}

It sets the max-width of the ul and ol (unordered and ordered list) to 50%.

Change the 50% part to 100% and it will use as much width as possible.

2 Likes

You are one absolutely outstanding human being. It worked, thank you so much for your help! I should probably learn some basic coding.

1 Like