Blog post with code

Hi,
I’m starting a blog! :slight_smile: So I created a blog page, and wrote my first entry. You can find it here: https://www.saers.com/dbclient/blog/

However, from the start I have formatting issues. I want to write about some Swift code, but as you can see, all indentation is gone.

In my editor it looks nicely formatted:

If I mark the text and select code, it looks green in the editor, and in the preview it becomes all one line:

Any suggestions as to how I can write code in my blog posts, preferably with a splash of Swift-like colours?

Anyone? Surely I can’t be the only one who has tried putting code into blog posts? :slight_smile:

Try https://www.w3schools.com/tags/tag_pre.asp

1 Like

You can also get a github account and embed “gists” into your blog posts.

1 Like

Thanks @instacks. Yes, pre would do, but how do I add HTML in the blog post editor in RW8?

Thanks @yabdab. Even though that would not keep all the content in one place and a place I control, gists are pretty neat, so I love the idea and want to try it out. I made my gist, copy the script, but when I paste it into the blog post editor, it pastes as markup text. So I assumed that didn’t work, but was pleasantly surprised to learn I could write HTML there directly. That answers my question to @instacks too, then :slight_smile: Thanks!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.