Actually for GDScript code you should always use backquotes as mentioned by bojidar_bg, or use a complete code block formatting (by prefixing everything with four spaces, or selecting your copy-pasted code and clicking the "code" button). For example:
func _input_event():
# this is a properly formatted code chunk
# and underscore_are_not_parsed_as_italic_markers
Which gives:
func _input_event():
# this is a properly formatted code chunk
# and underscore_are_not_parsed_as_italic_markers
But for normal text that contains underscores (e.g. URLs), it can indeed be a bother that it gets processed as Markdown italics, so you need to escape the underscore as mentioned by lukas (e.g.: some\_text\_with\_underscores), or format it as code as suggested by bojidar_bg (e.g.: `some_text_with_underscores`).