# Textmark

Textmark is a new approach for authoring structured text. Most markup languages, like LaTeX or Markdown, target one specific output format, like PDF or HTML.

Textmark, on the other hand, creates an extra layer of abstraction—a JSON based datastructure—which can easily be transformed into many different output formats like

• HTML Webpages,
• LaTeX source code,
• Markdown source code,
• Search-Index items, and much more.

One document, many structured applications.

## Guiding Principle

Textmark is an adaptable markup language. Markers are used to format text (hence the name) and insert non-text elements like images. The Textmark parser creates a JSON-object which gets converted using a Textmark converter into an output format.

Markers are defined as simple JSON objects, converters can be written in any programming language, no magic involved.

## Markers

A marker is made out of up to four components. The name of the marker, a list of parameters in square brackets, the text marked by the marker, and an alternative, plain text form in parentheses.

math[x is pi over 6]{x = \frac{\pi}{6}}(x = π / 6)

Simple examples include:

• dfn{Textmark} is plain text
• abbr[Hypertext Markup Language]{HTML}
• image[bird.jpg, bird@2x.jpg 2x][640][320]{a bird}

Markers can provide custom syntax sugar, e.g. typing pairs.

• *bold*bold
• _italic_italic
• $f(x) = \sin(x^2)$$f(x) = \sin(x^2)$

## Parsing

Textmark documents will never produce a fatal error when parsing. Unknown markers and broken syntax will be handled gracefully. Therefore, Textmark will never interrupt your build process if you don’t want it to. However, it reports warnings about any mistake it finds.

## Why Textmark?

While many markup languages can be used to generate all kinds of files, they typically are optimized towards one specific format. Take Markdown as an example. It shines at generating HTML documents which can be converted with little effort into RSS-Feed items or printed using the browser’s print function.

Unfortunately, Markdown’s syntax is only capable of expressing basic, HTML-compatible formatting. No mathematics, no images with multiple sources, no figures with captions, no video nor audio, no tables, …

This is why many markup authors nowadays use a superset of Markdown like MultiMarkdown, Markdown Extra, or GFM. This fragmentation of Markdown has lead to projects like CommonMark, which are trying to standardize all of Markdown flavors.

Textmark is extensible by default. It offers APIs for providing custom markers and APIs for converting Textmark objects into any file format you want. A solid standard library of markers ensures a common ground for all Textmark authors.

## Development Status

Development is currently in its earliest stages. This interactive Textmark editor you are currently using is a crude search ’n’ replace algorithm.

Once the syntax and API are finalized I am going to publish my work on the reference implementation of the Textmark parser on GitHub and link to it from here.