Cog-Creators / discord-embed-sandbox

Web-based sandbox for Discord Embeds with code generation
https://cog-creators.github.io/discord-embed-sandbox/
Other
63 stars 37 forks source link

Using -_ doesn't display in fields #14

Open ghost opened 3 years ago

ghost commented 3 years ago

Adding a field value (title isn't effected) of 3 specific chars (- or _) or more is not displayed on the embed preview. There may be more charecters that are affected by this but these are the only ones I identified quickly. The correct Python code preview is always displayed, it's just the embed preview that doesn't display them:

Two -

Screenshot 2020-11-14 at 21 54 52

Three -

Screenshot 2020-11-14 at 21 55 01

Again, the same results are produced for the underscore

Jackenmen commented 3 years ago

This is caused by the differences between Discord's Markdown parser and the markdown parser used by this project. From a quick look, it doesn't seem like showdown.js (library we're using for parsing and compiling Markdown) supports disabling individual Markdown rules, so fixing this might require changing the markdown parsing library to some more customizable one (if such one exists), so I wouldn't suspect this getting fixed in near time.

Help from other contributors is welcome here.

djfjfofoc3 commented 3 years ago

A simple hack should be able to fix this, such as

input=input.replaceAll('---','-​-​-')

(where the 2nd string has zero-width-spaces between each dash)

djfjfofoc3 commented 3 years ago

A simple hack should be able to fix this, such as

input=input.replaceAll('---','-​-​-')

(where the 2nd string has zero-width-spaces between each dash)

However, since this would be a quick solution, it might have some flaws that I have not thought about.