BNF of text/gemini
Here's the BNF (based on RFC-5234) of text/gemini, as it is probably produced today.
textgemini = *(link / preformat / heading / ulist / quoted / plain)
; Preformat toggle starts as 'false'.
plain = text end-of-line
; If preformat toggle is false, wrap text to the
; width of the display. Otherwise, do no wrapping.
preformat = "```" [alt-text] end-of-line
; Preformat toggle set to opposite state:
; false goes to true
; true goes to false
; While in preformat toggle is true, link, heading,
; ulist and quoted lines are NOT interpreted, but
; displayed as is to the user.
link = '=>' [SP] URI-reference [SP text] end-of-line
heading = '#' SP text end-of-line
/ '##' text end-of-line
/ '###' text end-of-line
ulist = '*' SP text end-of-line
quoted = '>' text end-of-line
alt-text = text
text = *(UVCHAR / WSP)
end-of-line = [CR] LF
UVCHAR = VCHAR / UTF8-2v / UTF8-3 / UTF8-4
UTF8-2v = %xC2 %xA0-BF UTF8-tail ; no C1 control set
/ %xC3-DF UTF8-tail
; CRLF from RFC-5234
; DIGIT from RFC-5234
; SP from RFC-5234
; VCHAR from RFC-5234
; OCTET from RFC-5234
; WSP from RFC-5234
;
; UTF8-3 from RFC-3629
; UTF8-4 from RFC-3629
; UTF8-tail from RFC-3629
The only possible breaking change is disallowing the C1 control set (ANSI terminal sequences) as there are sites out there that use them to set various colors.