Formatting text

Leafing through the pages, he saw the book was printed in two colours. There seemed to be no pictures, but there were large, beautiful capital letters at the beginning of the chapters.

Michael Ende, The Neverending Story (1979)

Basic styles

Inside paragraphs (and in other elements that support it) you can use text formatting which allows you to give text a certain style. Text formatting is done through symbols, enclosing a set of words between two identical symbols. Currently Mau supports

  • _underscores_
  • *stars*
  • ~tildes~
  • ^carets^
  • `backticks`
  • $dollars$
  • %percent%
Mau source
Stars identify *strong* text.

Underscores for _emphasized_ text.

Carets for ^superscript^ and tildes for ~subscript~.

Backticks are used for `verbatim` text.

$Dollars_and_percents$ are %used_to_escape_text%

Stars identify strong text.

Underscores for emphasized text.

Carets for superscript and tildes for subscript.

Backticks are used for verbatim text.

Dollars_and_percents are used_to_escape_text

Mixing styles

Text styles can be used together but backticks have a very strong behaviour in Mau

Mau source
You can have _*strong and empashized*_ text.

You can also apply styles to _*`verbatim`*_.

But verbatim will `_*preserve*_` them.

You can have strong and empashized text.

You can also apply styles to verbatim.

But verbatim will _*preserve*_ them.

Styles can be applied to only part of a word and do not need spaces

Mau source
*S*trategic *H*azard *I*ntervention *E*spionage *L*ogistics *D*irectorate

It is completely _counter_intuitive.

Parts of words can be ^super^script or ~sub~script.

There are too many `if`s in this function.

Strategic Hazard Intervention Espionage Logistics Directorate

It is completely counterintuitive.

Parts of words can be superscript or subscript.

There are too many ifs in this function.

Escaping

Using a single style marker doesn't trigger any effect. If you need to use two of them in the sentence, though, you have to escape at least one. Or use $ and %

Mau source
You can use _single *markers.

But you \_need\_ to escape pairs.

Even though you can escape \_just one_ of the two.

If you have \_more than two\_ it's better to just \_escape\_ all of them.

Or $you_can_just_use_dollars$ and %percents_which_escape_everything%.

Actually $dollars escape %percents%$, and %percents escape $dollars$%.

You can use _single *markers.

But you _need_ to escape pairs.

Even though you can escape _only one_ of the two.

If you have _more than two_ it's better to just _escape_ all of them.

Or you_can_just_use_dollars and percents_which_escape_everything.

Actually dollars escape %percents%, and percents escape $dollars$.

The purpose of backticks ` is to format code, as you will see in the chapter about templates, while the purpose of dollar $ and percent % is just to make it less complicated to represent text that has a lot of special symbols. Dollars and percents escape each other as they are pretty common symbols that you might need to use.

Text classes

You can assign specific classes to part of the text using the macro class. The way classes are used and rendered depends on the output format. If the output is HTML, those will become CSS classes, while PDF output at the moment doesn't do anything specific.

Mau source
This is [class]("text wrapped", myclass) in a class.

The HTML output of the code above is

HTML output
<p>This is <span class="myclass">text wrapped</span> in a class.</p>

You can specify multiple classes as arguments. There is no limit to the number of arguments.

Mau source
This is [class]("text wrapped", myclass1, myclass2) in multiple classes.

Resulting in

HTML output
<p>This is <span class="myclass1 myclass2">text wrapped</span> in multiple classes.</p>

Please note that the text passed to the macro class can contain Mau code such as styles.

Mau source
This is [class]("*text with styles* _wrapped_", "myclass") in a class.

Horizontal rule

You can add a separator or horizontal rule using three dashes --- on a separate line.

Mau source
---

Since markup languages are mostly used to write hyperlinked documents, links play a big part in the syntax. In Mau, links are created with the macro link.

Mau source
The source code can be found at [link](https://github.com/Project-Mau/mau).

The source code can be found at https://github.com/Project-Mau/mau.

The values between round brackets are arguments (see Basic syntax).

You can add optional text to the link that will replace the URL in the rendered text

Mau source
The source code can be found
on [link](https://github.com/Project-Mau/mau, GitHub).

The source code can be found on GitHub.

Using spaces and quotes

If the title contains spaces or the closing parenthesis ) you need to wrap it between double quotes

Mau source
The source code can be found
on [link](https://github.com/Project-Mau/mau, "the GitHub page").

The source code can be found on the GitHub page.

Should you need to add quotes to the title you will have to escape them

Mau source
The main [link](https://github.com/Project-Mau/mau, "\"repository\"").

The main "repository".

The same rules are valid for the URL

Mau source
A [link]("https://example.org/?q=[a b]","URL with special characters").

Mailto links can be created with the mailto macro, which works like the link macro described above.

Mau source
Get in touch at [mailto](info@example.com).

Get in touch at info@example.com.

Rich text

The text added to a link is rendered using Mau, so you can include styles or other macros, as long as the output makes sense in the target format. To avoid clashes between Mau syntax and arguments syntax, if you have rich text it is recommended to explicitly mark it as a named text argument.

Mau source
The source code can be found
on [link]("https://github.com/Project-Mau/mau", text="*GitHub*").

The source code can be found on GitHub.

In this case, the syntax [link]("https://github.com/Project-Mau/mau", "*GitHub*") would be interpreted as a link with subtype GitHub because of the leading *.

As for rich text, remember that Mau doesn't understand output formats, it merely uses templates. So, while it is possible in Mau to insert a link as a text for a link, that doesn't make sense in HTML or TeX.