I have read that doc and pdf files are risky i.e. vulnerable to altering when downloaded through Tor. Could text documents downloaded from ghostbin or pastebin be made malicious in transit too? What about website page downloads (one html file and one associated folder)? Will it be safe if I drag and drop these text and html files on Tor window to open them?
Web pages can contain live code. So, if the right conditions exist, it is possible for a safe page to have malicious code inserted during transmission, which then runs when you run it locally.
Text is text. Text files have to be opened in a text reader. It is more than possible for a text file to contain an exploit.
If the url is http (not https) they could.
There are studies about malicious tor nodes that inject virus in executables.
There are studies about internet routeurs (so it's apply to tor AND not-tor traffic) that inject ads in html webpages.
Will it be safe if I drag and drop these text and html files on Tor window to open them?
If you open local content with your tor browser, it doesn't transit on the network, so if that local webpage doesn't call external urls, it can't be altered by the network.