NAME
xtx - plain-text format
xtx, short for Nightfall Express Text, is a plain-text, non-hypertext markup language.
Like Gemtext, which it is inspired from, xtx is a line-oriented format.
A document consists of one or more lines. Like Gemtext:
- Heading lines start with #, 3 levels supported
- List lines start with *
- Quote lines start with >
- Each text line is a paragraph
Unlike Gemtext:
- Blank lines are ignored
- Preformatted text starts with two spaces
- There are no links
EXAMPLES
Convert 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)
next
}
NF != 0 { printf "<p>%s</p>", $0 }
SEE ALSO
https://nightfall.city/nex/in/m15o/projects/text.xtw