Line breaks show as regular spaces

I’m trying to edit the fields in a note and have to add some line breaks. However, they show just as regular spaces. Here is my code:

def tense_to_string(tense: list[str]):

    string = ''

    for i in tense:
        string = string + i + '\n'

    return string[:-1]


def fill_latin_verb(note: Note) -> None:
    if note.has_tag('regular'):
        showInfo('regular')
        if note.has_tag('primeira_conjugação') or note.has_tag('segunda_conjugação'):
            uerbum = note.fields[0]
            radix = uerbum[:-1]
            theme = radix + ('a' if note.has_tag('primeira conjugação') else 'e')

            tense = [theme for i in range(6)]

            note.fields[1] = tense_to_string(tense)

Edit: I’m aware of the
solution, I wouldn’t like to use it.

Try <br> instead of \n. The fields content is in HTML.

1 Like

I’m aware of this solution - should have mentioned it in the post. I know it’s possible to use ordinary line breaks in the fields, I use them when filling the fields through application or CSV files and I like much more the result visually. Is there anyway to achieve it from code?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.