Easiest way to copy and paste Safari page source code

Hello, I am wanting to easily view the codecademy project’s source code from Safari unto my text editor. When I open the page source in the finished project pages, it either displays the html from the index.HTML doc in a very impractical single line of code via the recourses tab or, if i go to the elements tab, I have to annoyingly open every little tab in the html only to not have any quick option for copying all of the html code at once so I can simply paste it in my text editor. I just want an easy way to copy and paste the properly formatted HTML and CSS code from the codecademy projects unto my text editor. There has to be a better solution for this is Safari. thanks.

Copy it and run it through a program that formats it (a beautifier)
You can’t skip the beautifying step if you want it beautified but you’re given only an uglified version

And since the html is just text, safari itself doesn’t have much to do with it. You could just the same get the source with curl or wget!

Safari might of course have some built-in beautifier but you’d have to ask them or google for it.

There’s a chrome plug-in that beautifies source, but if you insist on doing it with safari i guess that’s out of the question! Specifying that the problem needs to be solved with a specific tool certainly limits the possibilities