Topic: Update the DText guide with \`

Posted under e621 Tools and Applications

Today I learned in order to have a backtick ` be a backtick in DText, you need to put a backslash \ before it.
This is because of the description of post #6104228, which is a quote from the original Twitter post, which contains this:

( ` ε ´ )♡

I couldn't find this detail anywhere in the DText help guide, least of all in the section called Escaping DText and so posted about this issue in the Discord, which told me that someone had updated it by adding the aforesaid \ to fix the description.
I would also like to mention how that section is a disgrace being one sentence recommending 2 methods in the document without further details

I do not know if there are other such things in DText not readily avalible in the DText guide. However, if there are, they should, like this detail about backslash, be added to the guide.

Aacafah

Moderator

I've been working to improve the accuracy of the wikis, including the DText one, but it's extremely difficult & time-consuming to keep on top of these things; just look at the history for the search cheatsheet. Fwiw, I've always been this dedicated about documentation; I wrote this one & this one before I even joined staff.

The reason some of these aren't very robust is that, until relatively recently, there's been basically zero documentation on most of the code, & a lot of what's now there was written by me after manually reviewing & rewriting the code to determine how it behaves. That's why the search cheatsheet is so robust; I spent a lot of time getting intimately familiar with the post search parser when I added grouped searches, & put a lot of time into documentation both in code & on site.

However, the DText parser is separate from the rest of the application code, & I haven't had the time to poke around it like I have with the search parser, so I haven't had an opportunity to improve its documentation. I took a quick peek today & found that very few things properly respect the \ as a delimiter; in fact, as you can see from that errant , even the code backticks don't always properly respect it.

The way using the backslash as an escape character is supposed to work with markup languages like DText, Markdown, & HTML, is that a single backslash makes the following character be treated as plain text, with no special meaning (with the exception of escape sequences, but ignore that), while removing the escape character from the output. You can also escape the escape character, which would print the escaped backslash to the plaintext output. However, that's not how DText is currently working; it will only correctly resolve specific cases. For example, \`this shouldn't be code will be printed as

`this shouldn't be code

but \\`this shouldn't be code will be printed as

\`this shouldn't be code

because it's only resolving the backslash attached to the `. It also doesn't stop other tags from rendering like it should; for example,

[color=red]This[/color] should be [color=red]red[/color].

is correctly rendered as

This should be red.

But

\[color=red]This[/color] shouldn't be [color=red]red[/color].

is incorrectly rendered as

\This should be red.

instead of

[c0lor=red]This[/color] should be red.

(the o was replaced w/ 0 to force it to not match).

However, it is supported by ltables, with [[sdfasdf\|sdfasf]] rendering as

asdfd sdafasf sdfasdf
asdfd sdafasf sdfasf

instead of

asdfd sdafasf sdfasdf
asdfd sdafasf [[sdfasdfsdfasf]]

...but if you hover over the link, you can see the backslash still isn't being removed from the tag, so it's incorrectly added to the URL. Also, you just can't properly escape ltables (even in code blocks), which is why I did what I did both for that section in the help page & above.

Tl;dr Escaping is a deeply infuriating & inconsistent nightmare, & this is no exception. I'm somewhat hesitant to recommend the backslash as an escape character when it will only correctly escape a single character, but I'll try to add it (& it's caveats) to the wiki during my downtime at work today & see about fixing the parser to correctly & consistently resolve escapes.

Updated

I see. Thank you much for taking the time, not only over the years, but even now, to explain the frustrations of this site's code to people such as myself whom have little to no knowledge of these things.

I feel documents like this are important, not only to inform the presently unknowing adding to their knowledge, but also to show that there is someone who is still trying to improve things.

I'm sorry if my tone was rather brash. I look forward to seeing what you and any who find themselves working alongside you document in the future.

Aacafah

Moderator

You're good, I just wanted it to be clear that this is a sentiment shared by staff & explain why it hasn't been done yet, as well as prevent further confusion if anyone tries using it outside of escaping a `. I've added it to the DText wiki, & I'll be bringing up improving DText escaping with the rest of staff.