I am building an app to allow users to chat with characters using AI (sort of like character ai but more lengthy responses). The interface is going to support markdown for both the user and the AI's responses. Not being a role player myself I'm not too familiar with which of the markdown styles people usually use in most role play scenarios. I know for example italics is used to denote actions and speak from the third person, and bold is used for emphasis, etc. But what else? I don't think it makes sense to support ALL markdown syntax styles as I have a feeling only a small subset is actually used day to day.
3 Answers
This sort of thing isn’t standardized; it varies from group to group and sometimes from player to player.
On a technical level, you’re almost-certainly better off using an off-the-shelf, standards-based Markdown library than writing any partial implementation of your own. It’ll get you everything with minimal work on your part, it’ll work the way users expect, and odds are good it’ll have optimizations that will mitigate any difference in size or performance that your partial implementation would have.
-
1\$\begingroup\$ Another point to note is that Markdown (any tag language really, but MD is a particularly complicated case) carries a risk of XSS attacks if parsed badly. I used to be a member of a forum that was an early adopter of Markdown, and every other day you'd see the entire page spinning in circles because someone figured out another way to slap .fa-spin on <body>. \$\endgroup\$ Commented Sep 8 at 0:14
KRyan’s answer is spot-on and you should go read that first.
That said, there are a couple of additional considerations here that I feel worth pointing out which are unfortunately too much for a comment...
Most people will expect autolinking to work for URLs instead of requiring them to be explicitly delimited. Not all Markdown renderers support this, and many that do support it make it an optional thing. For reference, this is what lets you put a URL like https://rpg.stackexchange.com/ in an answer or comment here on StackExchange and get it automatically converted to a link to that URL.
You probably should support tables if possible. Not all Markdown renderers support them, and in many contexts they aren’t exceptionally useful, but for the specific case of TTRPG usage they are actually really useful to have for block formatting of information.
You may want to consider not supporting headings. In most chat apps that have them, I see them getting horribly misused for emphasis instead of indicating the start of a section, and even without that misuse it’s very very easy for them to cause accessibility issues for anybody who is interacting with your app using a screen reader, braille display, or other non-visual output media.
Seriously consider completely disabling support for raw HTML. This is one of the biggest potential sources of issues in Markdown, and it’s a potential source of not only bugs but even possibly security issues. At minimum you need to be filtering certain tags. See this section of the GitHub Flavored Markdown spec for a list of what they filter, which should be a starting point in your case (you probably also want to filter most input types, most media/embed tags, nav, figure, section, article, header, footer, aside, canvas, and likely quite a few I haven’t thought of).
This is unlikely to be a major issue for legitimate users because it’s actually pretty rare that you need HTML tags that Markdown itself does not support directly in most communications. The only ones I’ve ever seen used with any frequency are definition lists and the summary/details tags, and neither of those should be required in your case (definition lists can be replaced with tables usually, and the summary/details thing makes little sense in a realtime chat application).
First of all, I think this question isn't related to Role playing, despite the fact that you're building a Role playing app. It's a simply UX question, which has its own SE: https://ux.stackexchange.com/
That being said:
I don't think it makes sense to support ALL markdown syntax styles as I have a feeling only a small subset is actually used day to day.
On the contrary. It makes no sense to support only a subset of markdown. It will only confuse the user why he can use some MD formattings but not others. The only reason to only implement a subset is if you hate the end user and you want to troll them.
-
\$\begingroup\$ Your last sentence has some tone problems. Would you please re phrase that to come off as less hostile? \$\endgroup\$ Commented 3 hours ago
-
\$\begingroup\$ @KorvinStarmast No tone was intended, but I stand by the phrasing. There's countless examples of UX choices where the end user can only conclude that those choices were made out of hate towards them. The one OP describes would be one of those examples: he would go out of his way to remove parts of the MD syntax. Doing that can bring no good. It can only annoy the user. \$\endgroup\$– OpifexCommented 2 hours ago
<b>...</b>
, those are HTML tags; Markdown allows embedding HTML directly. \$\endgroup\$