Our knowledge base contains 7 categories and 56 answers

Found 0 answers

How to add Code blocks

author picture

Diya Sarkar

Customer Success Team


In the answer editor you can include Code blocks in your answers.


Code blocks will help you write some technical specification or part of your product where your users will need to work with code. You can provide step by step instructions to your users which readable and highlighted code blocks.


To add a Code block, follow the steps below:

STEP 1


  • Go to the Answer editor and open the answer you want to edit.
  • On the menu on the right grab the 'Code' block.
  • Drag it in the answer editor with the cursor.
  • Drop it anywhere in the answer where you want the code block to appear.

Codeblock

STEP 2

In the modal:

  • Paste the code that you want to add.
  • Select the language in the dropdown selector.
  • Click 'Add'

Add codeblock


Once you click on 'Add' your code block will be added to your answer.


To move, edit or delete the code block, you can hover over the it and click on the action buttons in the top left corner, as shown in the picture below:


Move edit or delete


Here is a live example of a code block:


// taking kilometers input from the user
const kilometers = prompt("Enter value in kilometers: ")

// conversion factor
const factor = 0.621371

// calculate miles
const miles = kilometers * factor

console.log(`${kilometers} kilometers is equal to ${miles} miles.`);


That's it!

updated 2021/10/01 20:14