jtxBoard icon indicating copy to clipboard operation
jtxBoard copied to clipboard

[Feature/Bug] Support rendering multiline Markdown code blocks

Open nomorsug opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. Multiline code blocks in Description field are not supported and if you try to enter them they are rendered as multiline empty space

example (the \ is at the end is escape to make GitHub render the literal block inside another block)

 ```bash
  #!/usr/bin/env sh
  
  foo 1  # this will fail because foo has not been declared yet.
  
  foo() {
      echo "Parameter #1 is $1"
  }
  
  foo 2 # this will work.

\```

Describe the solution you'd like Code blocks are rendered with optional syntax highlighting

Describe alternatives you've considered N/A

Additional context N/A

nomorsug avatar Oct 07 '23 12:10 nomorsug

Markdown is rendered by this library: https://github.com/ArnyminerZ/MarkdownText

@ArnyminerZ , would you have the time to look at this?

patrickunterwegs avatar Oct 09 '23 20:10 patrickunterwegs

Okay, so it's limitation of MarkdownText, in that case even if now implementing code blocks is not feasible they should at least be rendered as plain text instead of blank lines

nomorsug avatar Oct 12 '23 13:10 nomorsug

I just started using jtx board and multiline code blocks are one of the first things I tried.

BUT - multiline code blocks are supported - when prefixed by 4 spaces! They're displayed just fine, with a highlighted background. Single backtick (inline) code sections seem fine too.

It's only when the code block is bracketed by 3 backticks (as in @nomorsug's example above) that it doesn't display. Even so, it appears to me that a blank area the right size is displayed, so I suggest that the bug is that it's rendered white-on-white or something similar.

quignogs avatar Oct 27 '23 17:10 quignogs

BUT - multiline code blocks are supported - when prefixed by 4 spaces! They're displayed just fine, with a highlighted background. Single backtick (inline) code sections seem fine too.

four spaces is just the same as a single backtick at the start and end of each line. It is not a code block - the highlight does not continue to the margin

like this

nor does it allow for syntax highlighting (on a system that supports it)

for ($n=1, $n++, $n<100) {
    echo "like this";
}

nor can you paste a block of code as you can in a 3 backtick deliminated block. It is just rendered as single lines of inline code. If you copy the blank area, or display it in another markdown aware editor you will find there is nothing there - its not simply that the foreground colour is white.

This is surely a bug in the markdown plugin as it should ignore markdown codes it is not capable of rendering and present them as plain text - so you should see the three backticks and the code as text when viewing it, which would at least be useable and give something that rendered correctly on a code-block aware markdown viewer.

rogercreagh avatar Oct 28 '23 12:10 rogercreagh