Anselus Text Markup (AnTM)

Status: Review
Submission Date: August 8, 2019
Submitted By: Jon Yoder jsyoder@mailfence.com
Abstract: Rich text formatting language for client-side use

Changelog

0.0.1: Initial submission

Description

AnTM, pronounced “AN-tim” or “an-tee-EM”, is a plaintext-with-markup format for describing rich formatting in a way that is expressive, easy to parse, and easy to implement with a measure of safety and security. It borrows heavily from BBCode, but introduces changes to make it more consistent and full-featured while retaining simplicity. It is intended to be the transmission format for all text on the Anselus platform, including messages, notes, and so on.

Anselus clients have a need to provide users the ability to communicate in an expressive manner in the same way that has been established with HTML e-mail. HTML, unfortunately, presents a number of challenges, including security and historical quirks in its syntax.

The problems which AnTM is intended to solve in replacing HTML for rich formatting are as follows:

Syntax

AnTM marks text with pairs of tags enclosed in square brackets. Each opening tag MUST have a corresponding closing tag. Each closing tag MUST begin with a forward slash (/) immediately preceding the text of the closing tag. White space MAY be found between the square brackets and the enclosed text, but space MUST NOT be found between the slash and the tag text. For example:

Correct

[b]Bold text[/b]
[ b ]Bold text[ /b ]
[b ]Bold text[ /b]

Incorrect

[b]Bold text[\b]
[b]Bold text[/ b]
[b]Bold text[b/]

Opening tags MAY have parameters, depending on the specific tag. These parameters MUST follow the tag name and MUST be separated by one or more spaces or tabs. Newlines and carriage returns are ignored MUST NOT be placed within the tags.

Each parameter MUST follow the format of parameter name, equal sign, and value enclosed by double quotes. If a double quotation mark needs to be part of the parameter value, the escape code \u0034 MUST used in its place. Other escape codes MAY be used to specify other Unicode characters using the same format.

Correct

[font family="Arial" size="12" color="blue"]Styled text[/font]
[tag param1="Being \u0034cute\u0034"]Tag text[/tag]

Incorrect

[font family='Helvetica' size='9' color='red']Styled text[/font]
[font family:"Helvetica" size:"9" color:"red"]Styled text[/font]

Embedded Content

As a security and privacy measure, all content referenced in a document MUST be local to the client, such as a file or database record. Only filenames are used. The exact method of storing and retrieving said content is left to the implementor. For example, in the case of a note in which the user has inserted an image, the image MUST be local to the PC on which the note is written. Images obtained from the World Wide Web MAY be used ONLY if the image is first downloaded to local storage and then a link created which points to the downloaded copy.

Any references to non-local content SHOULD be displayed clearly as a hyperlink and be in a way that the user is able to see the exact destination. URL de-obfuscation is not a requirement, but is highly recommended. Conversion of escape codes to actual characters, such as %20 for spaces, is recommended for link display to aid less-technical users in understanding link destinations. Although not required, integration of website/domain reputation services is also recommended for client implementations.

Tag Reference

Align Text

Syntax

[align type="left"]aligned text[/align]

Parameters

type: REQUIRED. Specifies the type of alignment. May be left, center, right, or justified.

Notes

This tag specifies horizontal alignment of enclosed text.

Bold

Syntax

[b]Bold text[/b]

Parameters

None

Notes

This tag causes all enclosed text to be boldfaced.

Cell

[cell color="#EEEEEE" bgcolor="#111111" align="left" valign="top"][/cell]

Parameters

color: OPTIONAL. Color of the text in the cells.

bgcolor: OPTIONAL. Background color of the cells.

align: OPTIONAL. Horizontal alignment of the cell contents.

valign: OPTIONAL. Vertical alignment of the cell contents.

Notes

Defines a table cell. Only cell tags MUST be placed inside row or header tags. Table content MUST be placed inside cell tags. Non-compliant code MUST be ignored, and implementors are encouraged to remove non-compliant content.

Code / Preformatted

Syntax

[code language="markdown"]preformatted text[/code]

Parameters

language: OPTIONAL. Specifies a language, enabling syntax highlighting of the enclosed text.

Notes

This tag marks enclosed text as preformatted code. Such text MUST be rendered with a fixed-width font and whitespace MUST not be modified. A language MAY be specified, but syntax highlighting is not a requirement.

Document

Syntax

[document language="en-us" color="#ffffff" image="tile.jpg" repeat="yes"]
.
.
.
[/document]

Parameters

bgcolor: OPTIONAL. Specifies the background color of the page. It may be specified as an RGB hextet, e.g. #ff0033 or as a color name from the Color Reference section.

color: OPTIONAL. Specifies the default text color of the page. As with the bgcolor parameter, it may be specified as an RGB hextet, e.g. #ff0033 or as a color name from the Color Reference section.

height: OPTIONAL. Specifies the height of the document in inches (in) or millimeters (mm). Note that some contexts, such as conversion to HTML may ignore this value. This parameter is also ignored if the width parameter is omitted.

image: OPTIONAL. Specifies the name of the image to be used as the document background.

language: OPTIONAL. Specifies the language in which the document is written, specified as an IETF language tag, e.g. “en-us”.

repeat: OPTIONAL. Specifies whether or not the background image should repeat itself. Values MUST be yes or no. This parameter is ignored if the image does not exist or is invalid.

width: OPTIONAL. Specifies the width of the document in inches (in) or millimeters (mm). Note that some contexts, such as conversion to HTML may ignore this value. This parameter is also ignored if the height parameter is omitted.

Notes

This tag is used to enclose all text in the document. Any text preceding the opening tag or following the closing tag MUST be ignored or, even better, removed. Note that these parameters are all optional and MAY be ignored by the renderer.

[header color="#EEEEEE" bgcolor="#111111" align="left" valign="top"][/header]

Parameters

color: OPTIONAL. Color of the text in the cells.

bgcolor: OPTIONAL. Background color of the cells.

align: OPTIONAL. Horizontal alignment of the cell contents.

valign: OPTIONAL. Vertical alignment of the cell contents.

Notes

Defines a table header row. Only cell tags MUST be placed inside row or header tags. Table content MUST be placed inside cell tags. Non-compliant code MUST be ignored, and implementors are encouraged to remove non-compliant content.

Image

Syntax

[image name="image1.png" width="500" height="500"]Image Caption[/image]
[image name="image2.png" width="50%" height="50%"]Image2 Caption[/image]

Parameters

width: OPTIONAL. Specifies the image’s width in pixels or percent.

height: OPTIONAL. Specifies the image’s height in pixels or percent

Notes

Unlike HTML, tag pairs are used with images in AnTM documents, with the enclosed text to be rendered as the image’s caption. A number by itself MUST be considered a pixel size and a number ending in a percent symbol MUST be interpreted as a percentage relative to the image’s size in pixels.

Italics

[i]Italicized text[/i]

Parameters

None

Notes

This tag marks enclosed text as italicized.

[link url="" name=""]Link title[/link]

Parameters

url: OPTIONAL. The address of the link.

name: OPTIONAL. The name of the link – just like with named anchors in HTML.

Notes

Text enclosed in this tag pair is a hyperlink. Links MUST be either a relative in-page link or a canonical remote link. As stated in the Embedded Content section, implementors MUST clearly display links as such and are strongly encouraged to add features to protect users from malicious links and enable them to quickly understand the destination of the link.

List / List Item

[ulist style="disc"]
	[li]Item 1[/li]
	[li]Item 2[/li]
	[li]Item 3[/li]
[/ulist]
[olist style="upper-roman"]
	[li]Item A[/li]
	[li]Item B[/li]
	[li]Item C[/li]
[/olist]

Parameters

style: OPTIONAL. The style of list, such as upper-roman, square, or lower-alpha. For a complete list, consult the CSS3 list of styles for the property list-style-type.

The li tag has no parameters.

Notes

These tags are for constructing unordered and ordered lists.

Quote

[quote]Quoted text[/quote]

Parameters

None

Notes

Displays the enclosed text in a block quote style.

Row

[row color="#EEEEEE" bgcolor="#111111" align="left" valign="top"][/row]

Parameters

color: OPTIONAL. Color of the text in the cells.

bgcolor: OPTIONAL. Background color of the cells.

align: OPTIONAL. Horizontal alignment of the cell contents.

valign: OPTIONAL. Vertical alignment of the cell contents.

Notes

Defines a table row. Only cell tags MUST be placed inside row or header tags. Table content MUST be placed inside cell tags. Non-compliant code MUST be ignored, and implementors are encouraged to remove non-compliant content.

Strikeout

[s]Strikeout text[/s]

Parameters

None

Notes

Displays the enclosed text with a single-line strikeout style.

Styled Text

[style family="Arial" size="12" color="blue"]Styled text[/style]

Parameters

Family: OPTIONAL. The family name of the font to use.

Size: OPTIONAL. The size in points or, if px is appended to the size, pixels.

color: OPTIONAL. The color of the text. This may be specified by RGB hextet or by color name. See the Color Reference section for details.

Notes

This tag pair provides a fast, simple, flexible way to adjust the look of text. Note that the font must already be installed on the user’s system. Multiple font families MAY be specified in a comma-separated list as in HTML5 font tags. See the section Standard Fonts for more details on font availability.

Subscript

[sub]subscripted text[/sub]

Parameters

None

Notes

Text enclosed by this tag pair is rendered as subscripted text.

Superscript

[sup]superscripted text[/sup]

Parameters

None

Notes

Text enclosed by this tag pair is rendered as superscripted text.

Table / Row / Cell

[table border="1" color="#EEEEEE" bgcolor="#111111" linecolor="#000000" align="left" valign="top"][/table]

Parameters

Border: OPTIONAL. Thickness, in pixels, of the borders of the table.

color: OPTIONAL. Color of the text in the cells.

bgcolor: OPTIONAL. Background color of the cells.

linecolor: OPTIONAL. Color of the lines in between the cells.

align: OPTIONAL. Horizontal alignment of the cell contents.

valign: OPTIONAL. Vertical alignment of the cell contents.

Notes

The table tags enclose table structure tags, i.e. header and row tags, and enable default styling of the rows and cells. Text and other content are expected to be placed within cell tags. Content not following the expected structure of a table construct, for example, a cell tag pair not inside a header or row tag pair, MUST be ignored or, better yet, removed.

Underline

[u]Underlined text[/u]

Parameters

None

Notes

Text enclosed by this tag pair is rendered as underlined text.

Color Reference

AnTM color references follow Web standards, supporting 140 different color names and associated hextet values.

Color NameHex ValueColor
AliceBlue#F0F8FF
AntiqueWhite#FAEBD7
Aqua#00FFFF
Aquamarine#7FFFD4
Azure#F0FFFF
Beige#F5F5DC
Bisque#FFE4C4
Black#000000
BlanchedAlmond#FFEBCD
Blue#0000FF
BlueViolet#8A2BE2
Brown#A52A2A
BurlyWood#DEB887
CadetBlue#5F9EA0
Chartreuse#7FFF00
Chocolate#D2691E
Coral#FF7F50
CornflowerBlue#6495ED
Cornsilk#FFF8DC
Crimson#DC143C
Cyan#00FFFF
DarkBlue#00008B
DarkCyan#008B8B
DarkGoldenRod#B8860B
DarkGray#A9A9A9
DarkGrey#A9A9A9
DarkGreen#006400
DarkKhaki#BDB76B
DarkMagenta#8B008B
DarkOliveGreen#556B2F
DarkOrange#FF8C00
DarkOrchid#9932CC
DarkRed#8B0000
DarkSalmon#E9967A
DarkSeaGreen#8FBC8F
DarkSlateBlue#483D8B
DarkSlateGray#2F4F4F
DarkSlateGrey#2F4F4F
DarkTurquoise#00CED1
DarkViolet#9400D3
DeepPink#FF1493
DeepSkyBlue#00BFFF
DimGray#696969
DimGrey#696969
DodgerBlue#1E90FF
FireBrick#B22222
FloralWhite#FFFAF0
ForestGreen#228B22
Fuchsia#FF00FF
Gainsboro#DCDCDC
GhostWhite#F8F8FF
Gold#FFD700
GoldenRod#DAA520
Gray#808080
Grey#808080
Green#008000
GreenYellow#ADFF2F
HoneyDew#F0FFF0
HotPink#FF69B4
IndianRed#CD5C5C
Indigo#4B0082
Ivory#FFFFF0
Khaki#F0E68C
Lavender#E6E6FA
LavenderBlush#FFF0F5
LawnGreen#7CFC00
LemonChiffon#FFFACD
LightBlue#ADD8E6
LightCoral#F08080
LightCyan#E0FFFF
LightGoldenRodYellow#FAFAD2
LightGray#D3D3D3
LightGrey#D3D3D3
LightGreen#90EE90
LightPink#FFB6C1
LightSalmon#FFA07A
LightSeaGreen#20B2AA
LightSkyBlue#87CEFA
LightSlateGray#778899
LightSlateGrey#778899
LightSteelBlue#B0C4DE
LightYellow#FFFFE0
Lime#00FF00
LimeGreen#32CD32
Linen#FAF0E6
Magenta#FF00FF
Maroon#800000
MediumAquaMarine#66CDAA
MediumBlue#0000CD
MediumOrchid#BA55D3
MediumPurple#9370DB
MediumSeaGreen#3CB371
MediumSlateBlue#7B68EE
MediumSpringGreen#00FA9A
MediumTurquoise#48D1CC
MediumVioletRed#C71585
MidnightBlue#191970
MintCream#F5FFFA
MistyRose#FFE4E1
Moccasin#FFE4B5
NavajoWhite#FFDEAD
Navy#000080
OldLace#FDF5E6
Olive#808000
OliveDrab#6B8E23
Orange#FFA500
OrangeRed#FF4500
Orchid#DA70D6
PaleGoldenRod#EEE8AA
PaleGreen#98FB98
PaleTurquoise#AFEEEE
PaleVioletRed#DB7093
PapayaWhip#FFEFD5
PeachPuff#FFDAB9
Peru#CD853F
Pink#FFC0CB
Plum#DDA0DD
PowderBlue#B0E0E6
Purple#800080
RebeccaPurple#663399
Red#FF0000
RosyBrown#BC8F8F
RoyalBlue#4169E1
SaddleBrown#8B4513
Salmon#FA8072
SandyBrown#F4A460
SeaGreen#2E8B57
SeaShell#FFF5EE
Sienna#A0522D
Silver#C0C0C0
SkyBlue#87CEEB
SlateBlue#6A5ACD
SlateGray#708090
SlateGrey#708090
Snow#FFFAFA
SpringGreen#00FF7F
SteelBlue#4682B4
Tan#D2B48C
Teal#008080
Thistle#D8BFD8
Tomato#FF6347
Turquoise#40E0D0
Violet#EE82EE
Wheat#F5DEB3
White#FFFFFF
WhiteSmoke#F5F5F5
Yellow#FFFF00
YellowGreen#9ACD32

Standard Fonts

As part of the pursuit of good design, some attention to typography is important. Although users may have preferences, having some standardized available typefaces for the platform would be prudent. These fonts MUST be available and are recommended, but not required, be the default fonts for client software.

These font families have wide Unicode coverage and readability, enabling easy communication across many languages. Fira Code provides many helpful ligatures for code display.

Final Notes

BBCode, which was the inspiration for AnTM, was born out of a need for safety and security for user-submitted forum posts combined with a desire for expressiveness. Conversion to other formats is expected. However, UNDER NO CIRCUMSTANCES should any programming language text be permitted to execute. Ever. Any code in the body of a document should be treated like text. For example, in converting AnTM to HTML, the first change to be made should be substituting &lt; and &gt; for < and > in order to prevent any HTML tags, particularly <script> tags, from being executed or rendered downstream. This is not to say that syntax highlighting is forbidden; any text contents outside of the AnTM tags are expected to be displayed, not executed or rendered.

```