How to insert \n with activeMarkdownView.editor.setvalue()?

I’m building an auto regex plugin, which allows custom regex replacements to be executed to active note.

I observed that “\n” is written as normal text, while normal js output would be line breaks.

Would like to know if there’s valid way to adjust this behavior (maybe also for other special characters) except specifically replacing “\n” with line break unicode in replacement strings.