langfield / ki

version control for Anki collections
https://langfield.github.io/ki/
GNU Affero General Public License v3.0
70 stars 3 forks source link

We should not break lines within the HTML source #146

Closed langfield closed 8 months ago

langfield commented 1 year ago

Even if you have a literal \n, as opposed to a <br> tag, this still gets interpreted by cloze-overlapper as a newline, and thus it creates an extra cloze deletion card. We do not want this, thus we cannot add extra newlines willy-nilly via html-tidy.

Just another reason to make the whole thing idempotent.

The HTML is the single-source-of-truth. Every newline you make in the note editor in Anki is converted to a <br> tag. We must convert the HTML in each field we parse into plaintext and then back again in a completely invertible way. This means we absolutely cannot add whitespace for readability.

We might be able to do something like this though:

### Front
a
###
### Back
b
###

Important to note that we can convert <br>s to literal newlines in the markdown (and should).

It is also possible that we could just fork cloze-overlapper and disable this newline behavior.

langfield commented 9 months ago

This was possibly fixed by #152.

langfield commented 9 months ago

We just need to write a test for this and then we can close it! 😄