As far as I can find, there isn't a specific style for doing this. Maybe there is some style guide out there that specifies a preferred method, but isn't anything that shows up in any books I've read. Also, generally, it doesn't matter. If you submit the work for publication, editors will fix it. Chose a style that you like and use it consistently.
I think the big concern is how much your character is going to be writing in a scene. If it's a very active scene, with the character writing and doing things and interacting with their environment: handling the pen, adjusting the desk light, etc., then I'd treat what the character writes in the same fashion as dialogue. I'd use quotes for exact quotes of what the character wrote and I'd summarize the text that wasn't exactly quoted, just like I would indirect thought or indirect dialogue.
If the whole written text shared with the reader is the exact text and there isn't a reason to show the scene in real-time, then I'd consider writing that portion in an epistolary form -- like a letter or diary entry included as part of the story. And, in that case, it ought to look like a letter or diary entry -- no quotes, no attributes.