echo nex/in/m15o/projects/text.xtw | nc 1900 | less


So you are probably thinking...

What is this!?

And you'd be right. For real. What is this?

This is a plain text file, like many on this part of the web. It ha one particularity, which makes it a bit special. When viewed on browser that supports it, like kinex (web), it makes titles, quotes lists and paragraph stand out. It makes the text within a paragrap flow throughout the length of the page and automatically soft-wrap. Bu when viewed on a terminal, the lines are hard-wrapped for you withou the need of a special browser. Do the following if you'd like to try:

echo nex/in/m15o/about.txt | nc 1900 | less

Regarless of where you open a xtw file, it will be readable. Even i you don't have any supporting software!

xtw... what is that?

It actually means Nightfall Express Text Wrapped. It's a long name that's why it's better to just write xtw. Before we explain th "Wrapped" part, we can start just by the Nightfall Express Text.

Nightfall Text

It's little markup language for text that's derived from Gemtext. It' basically the same, but has little differences.

You might be thinking, why no links? The format isn't meant to b hypertext. Gemtext is already great for that! Nex uses menu (directories) to allow navigation. It is, however, okay to have URLs i the text.

The rest is the same as gemtext.


The first step for a client to read a xtw document is to "unwrap" it To do so, a client needs to replace every occurence of


by a space. Conveniently, this is the way the `fold` command wraps tex when using the -s option. For example, to wrap the text at the 72n character, we can do:

fold -sw 72

Here's an example script using awk to unwrap:

awk '/[^ ] $/ { printf("%s", $0); next } { print }'

Putting it together

Once unwrapped, it's just xtx. Here's an example of a filter tha transforms xtx to html:

#!/bin/awk -f

mode == "pre" && !/^  / {
	mode = ""
	printf "</pre>"

mode == "list" && !/^\* / {
	mode = ""
	print "</ul>"

/^# /   { printf "<h1>%s</h1>", substr($0, 2); next }
/^## /  { printf "<h2>%s</h2>", substr($0, 3); next }
/^### / { printf "<h3>%s</h3>", substr($0, 4); next }
/^> /   { printf"<blockquote>%s</blockquote>", substr($0, 2); next }
/^  /   { if (mode != "pre") {
            printf "<pre>"
            mode = "pre"
          } else {
            print ""
          printf substr($0, 3)
NF != 0 { printf "<p>%s</p>", $0 }

Thank you for reading!