A paragraph of text markup and text display issues

I’m using a marktext to mark up a piece of text in this way

fileInfo.files = CodeMirror.fromTextArea(myTextarea as HTMLTextAreaElement, options as any)
fileInfo.files?.markText({line:1,ch:1}, {line:20,ch:23}, {readOnly:true,className:“codemirrorText”});

this is class
.codemirrorText {
background-color: red !important;
font-size: 24px;
color: green;
}
But did not work in the plug-in, please know the friends tell me how to do, in advance in this thank you.

Another problem is that I use setValue() to set the updated text contents, but the order of display in the text is not consistent. For example, the text that would have been displayed at the beginning will be somewhere in the middle. When the content is initialized, the string is not processed, and the rule for newline is’ \r\n '. When I remove the ‘r’ ‘preserve’ \n 'format, it still does not display correctly, please tell me what to do.

If the author sees it, I hope you can reply. It is really urgent, and I have no clue about the delivery of the project

That call to markText looks correct, so I can’t really say what might be happening here.

oh markText({line:1,ch:0},{line:200,ch:0},{css:‘background-color:red’})
I set the css style to be valid and the className class name is not valid, so this issue is resolved for now. I would like to ask you to tell me another question about setValue displaying text out of order. Thank you very much

setValue just sets the document to the exact text you give it. I suspect the problem is somewhere else.

Could you give me some suggestions or directions that might lead to such problems? At present, I don’t know where to analyze the problem.

Or you can provide a good example demo that I can use as a reference