# Blog post with code

**URL:** <https://forums.realmacsoftware.com/t/blog-post-with-code/33846>\
**Category:** RapidWeaver Classic\
**Created:** [July 16, 2020, 5:01pm UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846 "2020-07-16T17:01:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![niklassaers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/niklassaers/32/16809_2.png) [@niklassaers](https://forums.realmacsoftware.com/u/niklassaers)\
**Post date:** [July 16, 2020, 5:01pm UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846/1 "2020-07-16T17:01:48Z")

</div>

Hi,  
I’m starting a blog! 🙂 So I created a blog page, and wrote my first entry. You can find it here: [https://www.saers.com/dbclient/blog/](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:

 ![40](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/7/a/7a4e9e365c06f845c1f2a94cb9e4d3d1def1eb3e.png)

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

 ![27](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/5/7/57d2b82990ed5fa25dc9dbf3ab4d35a08cf397d5.png)

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

---

<div class="post-metadata">

**Author:** ![niklassaers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/niklassaers/32/16809_2.png) [@niklassaers](https://forums.realmacsoftware.com/u/niklassaers)\
**Post date:** [July 18, 2020, 9:57am UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846/2 "2020-07-18T09:57:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![instacks](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/instacks/32/23339_2.png) [@instacks](https://forums.realmacsoftware.com/u/instacks)\
**Post date:** [July 18, 2020, 10:26am UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846/3 "2020-07-18T10:26:38Z")

</div>

Try [https://www.w3schools.com/tags/tag\_pre.asp](https://www.w3schools.com/tags/tag_pre.asp)

---

<div class="post-metadata">

**Author:** ![yabdab](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/yabdab/32/26154_2.png) [@yabdab](https://forums.realmacsoftware.com/u/yabdab)\
**Post date:** [July 18, 2020, 11:12am UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846/4 "2020-07-18T11:12:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![niklassaers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/niklassaers/32/16809_2.png) [@niklassaers](https://forums.realmacsoftware.com/u/niklassaers)\
**Post date:** [July 18, 2020, 7:15pm UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846/5 "2020-07-18T19:15:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![niklassaers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/niklassaers/32/16809_2.png) [@niklassaers](https://forums.realmacsoftware.com/u/niklassaers)\
**Post date:** [July 18, 2020, 7:25pm UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846/6 "2020-07-18T19:25:03Z")

</div>

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 🙂 Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [August 18, 2020, 5:25am UTC](https://forums.realmacsoftware.com/t/blog-post-with-code/33846/7 "2020-08-18T05:25:04Z")

</div>

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