Printing \ on both android and PC

Hello. I have a field containing the answer

\s

This shows up correctly as “\s” on anki on PC, but in ankidroid the \ is treated as an escape character, and I only see an “s”.

If I escape this with another \, for “\\s”, this shows me “\s” on ankidroid, but “\\s“ on PC.

What do I do to make this card work right on both platforms? < code > doesn’t seem to exist…

Please show us the exact HTML string you’re using in your notes –
```

in a preformatted-text/code block 

```
– so the forum doesn’t eat it.

You mean the field contents?

\s

I mean the exact field contents (in the HTML version) that you’re having trouble with – since you mentioned both backslashes and HTML tags.

But if you “escape” your backticks here, they won’t work. Use 1 backtick before/after for a single line – 3 backticks above/below for multiple lines.

Yes, I did that. OK, dunno what happened to my first reply, because it was showing correctly before. The original post has been correct all along.

\s

That’s the entirety of the field, it’s just regex for whitespace.

On desktop Anki (on Mac), I confirm that entering \s in a note field displays as “\s” in the card preview.

This behavior occurred using either the regular or HTML editor:

  • Entering \s in the regular editor resulted in the same \s appearing in the HTML editor and “\s” appearing in the card preview.
  • Entering \s in the HTML editor resulted in the same \s appearing in the regular editor and “\s” appearing in the card preview.

I also verified on AnkiMobile that \s note fields also correctly appear as “\s” on the card preview.

I don’t use AnkiDroid to be able to test it. But, I assume that if \s note fields appear as “s” on the card, then that behavior is incorrect and a bug? I am assuming that the behaviors should be the same on desktop Anki and AnkiDroid?

Yeah, you’d think.