Textbox.io ships with built-in macros that aim to improve the user editing experience. They are all enabled by default; this configuration setting can be used to control which macros are enabled. Additional macros can be added using the editor.macros runtime API.

While these macros are in all versions of the editor, this API to control them was introduced in Textbox.io release 2.4.1

Available macros

The built-in macros are grouped into into sets based on the type of tags they produce. Markdown macros are also listed in the Textbox.io help dialog for user reference; disabling a macro set does not however adjust the contents of the dialog.

Headings

This macro set converts Markdown heading syntax into H1-H6 tags.

SyntaxHTML result
# Largest Heading<h1>Largest Heading</h1>
## Larger Heading<h2>Larger Heading</h2>
### Large Heading<h3>Large Heading</h3>
#### Heading<h4>Heading</h4>
##### Small Heading<h5>Small Heading</h5>
###### Smallest Heading<h6>Smallest Heading</h6>

Lists

This macro set converts Markdown list syntax into UL and OL tags.

SyntaxHTML result
* Unordered list<ul style="list-style-type: disc"><li>Unordered List</li></ul>
1. Ordered list<ol style="list-style-type: decimal"><li>Ordered List</li></ol>
a. Ordered list<ol style="list-style-type: lower-alpha"><li>Ordered List</li></ol>
i. Ordered list<ol style="list-style-type: lower-roman"><li>Ordered List</li></ol>
1) Ordered list<ol style="list-style-type: decimal"><li>Ordered List</li></ol>
a) Ordered list<ol style="list-style-type: lower-alpha"><li>Ordered List</li></ol>
i) Ordered List<ol style="list-style-type: lower-alpha"><li>Ordered List</li></ol>

 

Semantics

This macro set converts variations of the markdown Italic and Bold syntax into EM and STRONG tags.

SyntaxHTML result
*Italic*

<em>Italic</em>

_Italic_

<em>Italic</em>

**bold**

<strong>Bold</strong>

__bold__

<strong>Bold</strong>

HR

This macro converts a triple dash into a HR tag.

SyntaxHTML result
---

<hr />

Entities

This macro set offers a convenient shorthand for a few HTML entities

SyntaxHTML resultCharacter
(c)

&copy;

©
--

&mdash;

-

&mdash;

Link

This macro implements the editor autolink feature.

SyntaxHTML result
http://ephox.com

<a href="http://ephox.com">http://ephox.com</a>

www.ephox.com<a href="http://www.ephox.com">www.ephox.com>

Properties

PropertyTypeValue
allowedArray

An array of built-in macros that are allowed (any macro not in this list is disabled).

Example Configuration

This example shows the default macro configuration where all built-in macros are enabled.

var config = {
	macros: {
		allowed : [ 'headings', 'lists', 'semantics', 'entities', 'hr', 'link' ]
	}
};
 
var editor = textboxio.replace('#targetId', config);

See Also

Macros: Writing Content-Aware Code