Jump to main content Open App

Adding a code block

When writing technical articles about programming it is often very helpful to add examples of code. With Writerie we make this easy, here is how.

# Add a code block

The code icon

As you may already know, in the Rich Text Editor Mode when you start a new line a menu appears with formatting options. From there choose the code button.

After clicking on it, you will get an empty code block. So far so good.

# What language is it?

Once you start writing actual code, we try, mostly successful, to detect the programming language and show it. Furthermore, we will also highlight your code accordingly. Pretty neat, isn't it

A code block with the content "var isJavaScript = true" which is highlighted and JavaScript is shown as the language

# Change it

You can of course always change your code, we will still autodetect the language and highlight the code.

# Markdown

When you export to markdown, we will also mark the code blocks with the detected language so you don't have to change anything there. If you prefer to use the Markdown Editor you can of course also declare the language their using Markdown syntax ```javascript and we will keep this when you switch to the Rich Text Editor.

That's it for this short tip. Keep writing!