Saturday, June 12, 2021

Blogger tips and tricks

How to paste code in Blogger

I mean how to paste the code so it looks nice. On the Internet, guys advise to use <code> tags, other special tags and even to install some add-ons or scripts. In addition to all these ways, here is one more trick. Copy the code and paste it in any file in any file of the current code editor project. E. g. for me it is Android Studio or Intellij. Then, copy it from the code editor and paste in the Blogger post by simple Ctrl+V (not by pasting as a plain text). This way it will save formatting of the original. So finally we will get something like that:

Firebase.messaging.token.addOnCompleteListener(OnCompleteListener { task ->
if (!task.isSuccessful) {
Log.w(TAG, "Fetching FCM registration token failed", task.exception)
val token = task.result

In the end, do not forget to delete the buffered code from the code editor.

No comments:

Post a Comment