Feature #22843

Use "```" instead of "~~~" for fenced code blocks in Markdown

Added by Jean-Claude Wippler almost 2 years ago. Updated about 1 month ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Text formatting
Target version:4.1.0
Resolution:

Description

When using the pre button in the web editor to insert a pre-formatted code block for a project which uses Markdown formatting, the lines inserted contain "~~~", which does not work in Markdown. It should insert lines "```" instead (possibly also preceded and followed by an empty line, not sure).

Very easy to reproduce: in a Markdown project, add an entry, press the "pre" button, click on "Preview". The resulting page shows "~~~" instead of a proper code block.

22843-use-triple-back-quotes-for-fenced-code-block.diff Magnifier (81 KB) Go MAEDA, 2018-01-08 06:11


Related issues

Blocked by Redmine - Defect #25299: Markdown pre-block could derive incorrect wiki sections New

History

#1 Updated by Go MAEDA over 1 year ago

'~~~' is also correct Markdown and works as expected on my environment.

http://spec.commonmark.org/0.25/#code-fence

#2 Updated by Taiki IKEGAME 2 months ago

I made a long name plugin.

https://www.redmine.org/plugins/redmine_github_style_fenced_code_block

Certainly triple tildes are not wrong syntax, but most people are using triple back quotes.
So, it is one of the features of markdown that the readability is high even for raw data. However, the triple tildea is similar to the strike (double tilde) syntax, and it is less readable. If it is a triple backquote, it can be distinguished from a strike. In addition, since it is similar in syntax to inline code (single backquote), the format of the document is consistent.

I think that the input of the markdown toolbar should be changed to triple backquote.

#3 Updated by Go MAEDA about 1 month ago

  • Blocked by Defect #25299: Markdown pre-block could derive incorrect wiki sections added

#4 Updated by Go MAEDA about 1 month ago

Taiki IKEGAME wrote:

Certainly triple tildes are not wrong syntax, but most people are using triple back quotes.

I agree with you, I feel "```" is much more popular than "~~~". To be honest, I have not seen "~~~" other than Redmine.

I wrote a patch to use "```" instead of "~~~". I suggest including this change in the future release. Setting target version to 4.1.0.

#5 Updated by Taiki IKEGAME about 1 month ago

@Maeda-san Thank you so much!

Also available in: Atom PDF