Escaping in gemtext

Ali Fardan raiz at stellarbound.space
Tue Nov 10 02:03:30 GMT 2020


On Mon, 9 Nov 2020 20:38:08 -0500
Ryan Westlund <rlwestlund at gmail.com> wrote:

> According to the Gemtext specification, any line that starts with
> "```" is a preformatting toggle. This makes it impossible to have such
> a line as part of a preformatted block. I understand the design goals
> of Gemtext, but I believe the Markdown solution to the same problem
> can be lifted straight into Gemtext relatively easily: allow more than
> 3 backticks to open a preformatted block, and require the same number
> to close it as the number that opened it. This way, any possible text
> can be included in a preformatted block. Thoughts?

No, I don't like that idea.

> The same issue exists with text lines (it's impossible to display "=>"
> or "#" at the beginning of a line of text), but I'm not concerned
> about that because having to prefix such lines with a space is not a
> big deal for plain text, whereas it is for code.

I have suggested this in IRC as I've considered that someone might have
use for this, I agree with your argument, and since gemtext processing
happens only by reading the first few bytes of each line, it is
possible to introduce a new line format that is '\' which is escaped
line, where it discards line formatting that is based on the first few
characters so

>	\=> this is escaped

will print

>	=> this is escaped

also keep in mind that '\' does not only escape the character after it,
it disables line formatting, because in the example above, if '=' is
escaped, '>' is right after it and can be interpreted as a quote.

Now, even pre-formatted text toggle characters can be escaped by adding
a rule in your parser to consider '\```' within a pre-formatted text
block and translate it to literal '```'.

Anyone else who might find my suggestion unappealing or have a better
idea, feel free to share, I think this is a flaw with the gemtext
document format not to have a way to escape certain characters to
disable them from being interpreted mistakenly, all other formats do
have a mechanism for doing this.


More information about the Gemini mailing list