Skip to main content

DekiScript 101

Written by Miller Saltzman
Documentation Editor, Customer Success at MindTouch
This page applies to:MindTouch Responsive

You have no idea how to use DekiScript? This article simplifies the basics so that anyone can do it. If you have few or no technical skills this is the article for you. It will help you understand the basics of MindTouch's language—DekiScript.

Why should I use it?

  • It is a tool that will help you make your site awesome.
  • It makes your life easier so you do not have to write more than you need to if you want to copy an article to another location.
  • It can personalize your site by showing different content depending on who is using your site.
  • It is a much nicer, controlled experience for writing HTML than view>source.

How to write DekiScript

There are two ways to write DekiScript in the MindTouch editor.

  1. Go to "Styles" on the last row of your editor next to headers (Normal, H1, H2, H3, Hx). Then select "DekiScript" from the dropdown menu.
  2. Type two braces, type your DekiScript, and then close it with two more braces. It should look like this:
{{"this is text"}}

NOTE: The second way is for people who are more advanced with DekiScript who want to add something in the middle of a line of text. If you are a beginner stick to using the DekiScript style for now. 

What do I write?


Here are some quick definitions of symbols that are commonly used in DekiScript, followed by examples of what they look like in the DekiScript editor and on your page after you save it:

  • Comment: The key to writing good code is leaving comments along the way explaining why you chose to do things the way you did them. Anything that follows two forward slashes is a comment. It is only used to make comments to other people using the DekiScript. It will not affect the DekiScript you are writing.
//This is a comment

Click save and you will not see anything on your document because notes can only be seen in the editor.

  • Text: Anything in between quotation marks is a string of text.
"This is text"

Click save and you will see this: This is text

  • HTML: <a href="">"Text for your hyperlink"</a>: In DekiScript, hyperlinks are created the same way they are created in HTML. Just place the URL between the quotation marks after href, and the text that you want to link to the URL between the quotation marks before the </a> tag.
<a href="">"MindTouch"</a>

Click save and you will see this: MindTouch

  • Concatenate: "..x.." :Two periods before and after a variable will connect the variable's value to the text before and after it.
var x=5;
var y=6;
Click save and you will see this: 56
  • Line break: <br/> : a line break tells the computer to go to the next line.
"Today you are learning DekiScript.";<br/>
"Don't forget to put a semicolon after the text and before the line break.";

Click save and you will see this:

Today you are learning DekiScript.
Don't forget to put a semicolon after the text and before the line break.
  • Line space: <br/><br/>: a line space tells the computer to add a blank line after your text. It does what pressing the enter key twice would do in the editor. 
"Today you are learning DekiScript.";<br/><br/>
"Don't forget to put a semicolon after the text and before the line break or line space.";

Click save and you will see this:

Today you are learning DekiScript.

Don't forget to put a semicolon after the text and before the line break or line space.
  • = sets something
  • == compares things
  • && and
  • || or
  • != does not
  • () allows DekiScript in html​


Variables allow you to declare that something equals a value.

For example, I want to make "x" equal the value of 5. So I type:

  • var which means variable

  • x the letter that I want to use as a variable
  • = the equal sign means I want to set the value of my variable
  • 5 the value I want the variable to be
  • ; a semicolon is needed to end each line of code
var x=5;

You will not see this unless you reference the variable.

For example, if I want to show the number 56, I will make "x" equal 5 and "y" equal 6 like I did above. And then type this:

  • " an open quote is used to start a string of text
  • " this open quote is used to start the "x" variable text
  • .. these two periods make sure the text before and after the x variable concatenate, or come together.
  • x a variable
  • .. in order for the text to be concatenated there needs to be two periods after the variable as well as before.
  • " this end quote is used to end the "x" variable text
  • " this open quote is used to start the "y" variable text
  • .. start of concatenation 
  • y a variable
  • .. end of concatenation
  • " this end quote is used to end the y variable text
  • " this end quote is used to end the whole string of text
  • ; this ends the statement
var x=5;
var y=6;
It should look like this: 56


Now that you know how to declare variables and concatenate, it is time to learn about objects. There are three objects: user, page, and site. Each object has properties. Properties follow objects after the period.

For example:, user.displayname, user.anonymous, page.title, page.uri,, site.url, site.api,

"The users name is: ";<br/>
"The users display name is: " ..user.displayname;<br/>
"The page title is: ";<br/>
"The page uri is: ";<br/>

When you click save it will look like this:

The users name is: Anonymous
The users display name is: Anonymous User
The page title is: DekiScript 101
The page uri is:

The If statement

If statements tell the computer to do something if something else happens. It is like an if/then statement.


if ( == "Admin")
    "This information can only be seen by the admin. No other use user can see it.";
    "If you do not want non-admin users to see anything just do not type anything between the quotation marks";

NOTE: Make sure that the "a" in admin is capitalized. If you would like for it to not be case sensitive create a variable for the and add "string.tolower" before it. Like this:

var luser = string.tolower(;
if (luser == "admin")
    "Hello, admin.";
    "You are not an admin.";

Why use it?

  • If you want to add information to a document that only the admin can see, or only a specific user can see.
  • If you want to add information to a document that only appears in certain circumstances. 

The If Not statement

Sometimes you might want to create an if statement telling the computer what to do if something does NOT equal something. != means "does not."  For example:

var x =25;
if ( != "Admin")
let x = 75;

This will look like this:


Having trouble?

If the computer can not understand your DekiScript it will show a message in bright red and tell you where you make your mistake. It will look like this:

"}" expected: /content/body/pre[2], line 5, column 1  

This is the DekiScript that led to the above error:

var x =25;
if (user.title != "How to Use DekiScript for Programmers")
"If you are a programmer look at this link instead:"
let x = 75;

The error message will tell you where you made your mistake. In this case you would go to the fifth line of DekiScript. The number next to column will tell you how many symbols to the right you made your mistake. When the column number is "1" it usually is an issue at the end of the line before it. Can you figure out what the issue is here? I forgot a semicolon at the end of line 4!

  • Did you remember to type a semicolon at the end of every line?
  • Did you remember to put quotation marks around every line of text?
  • Was this article helpful?