Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord Venue with Code Highlighting #402

Open
mrcaseb opened this issue Nov 6, 2021 · 3 comments
Open

Discord Venue with Code Highlighting #402

mrcaseb opened this issue Nov 6, 2021 · 3 comments
Labels
feature a feature request or enhancement venue 🏛

Comments

@mrcaseb
Copy link

mrcaseb commented Nov 6, 2021

The default gh venue works mostly fine in discord except one minor detail:

Code highlighting only works if there is no blank space between the first three backticks and the language, i.e.

this won't get code highlighting

​``` r
message("Hello World")
​```

but this would get R code highlighting

​```r
message("Hello World")
​```

It would be great to have a venue that doesn't add that blank space. Thanks!

@jennybc
Copy link
Member

jennybc commented Aug 14, 2022

Given that we just used Discord as part of the remote experience for rstudio::conf(2022), I'm pretty interested in this.

I've replicated the behaviour, i.e. that the presence of the space between the backpacks and

I think this would be fairly simple to implement and would have a lot in common with the Slack venue.

@jennybc jennybc added feature a feature request or enhancement venue 🏛 labels Aug 14, 2022
@jennybc
Copy link
Member

jennybc commented Aug 16, 2022

Transferring some relevant URLs out of my browser tabs before I close them:

https://pandoc.org/MANUAL.html#extension-fenced_code_attributes

Optionally, you may attach attributes to fenced or backtick code block using this syntax: ... Some output formats can use this information to do syntax highlighting ... A shortcut form can also be used for specifying the language of the code block: ... If the fenced_code_attributes extension is disabled, but input contains class attribute(s) for the code block, the first class attribute will be printed after the opening fence as a bare word.

https://spec.commonmark.org/0.30/#fenced-code-blocks

A code fence is a sequence of at least three consecutive backtick characters (`) or tildes (~). (Tildes and backticks cannot be mixed.) A fenced code block begins with a code fence, preceded by up to three spaces of indentation.

The line with the opening code fence may optionally contain some text following the code fence; this is trimmed of leading and trailing spaces or tabs and called the info string.

It's pretty clear Discord does not hold itself to any sort of specific standard when it comes to markdown support. If it did, the presence of a space between the backticks and the language identifier would not have the effect of printing the specified language as a bare word. But this is good context re: venues that sort of want people to post code, but that don't adhere to a proper spec.

@jennybc
Copy link
Member

jennybc commented Aug 17, 2022

Discord seems to also need simplify_image_links(), as Slack does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement venue 🏛
Projects
None yet
Development

No branches or pull requests

2 participants