I have copied a code text from StackExchange:
This is the line of code to edit
I pasted that code line in a LibreOffice Writer document and it was pasted with this exact font and grey background in LibreOffice Writer.
To give it a more default appearance I mark it and "clear direct formatting". That changed it only a bit: Aligned it's first line to the left (as it was aligned centered).
If Direct formatting isn't the right tool, what is?