diff --git a/anki/latex.py b/anki/latex.py index fdb14e463..f46e0a654 100644 --- a/anki/latex.py +++ b/anki/latex.py @@ -61,10 +61,11 @@ def _imgLink(col, latex, model): def _latexFromHtml(col, latex): "Convert entities and fix newlines." + # entitydefs defines nbsp as \xa0 instead of a standard space, so we + # replace it first + latex = latex.replace(" ", " ") for match in re.compile("&([a-z]+);", re.IGNORECASE).finditer(latex): if match.group(1) in entitydefs: - if match.group() == " ": - continue latex = latex.replace(match.group(), entitydefs[match.group(1)]) latex = re.sub("", "\n", latex) # replace
etc with spaces