To use it, just type in the textarea like this
Ni3 hao3! Ta1 shi4 wo3de nv3peng2you2!
And it outputs
Nĭ hăo! Tā shì wǒde nǚpéngyóu!
I propose that this code be added to the markdown editor, perhaps with a flag to turn it on and off, so that it can be used easily while typing. It solves the problem of knowing which letter gets the tone, which characters are used for the tone marks, and how to input
ü. It also works with capital letters. With a bit of tweaking it can be enhanced to work properly on letters as the words are typed.
- It rescans the whole text with every keyup/down.
- It doesn't allow you to write anything with the letter v in it.
- While editing text in the middle (as opposed to appending at the end) it causes your cursor to jump around.
- Probably many more.