TechbeeAT / jtxBoard

jtx Board allows you to manage your Journals (like meeting minutes), Notes and Tasks in one Android app. The app is compatible with the iCal standard (RFC5545) and is integrated with DAVx5 to allow the synchronisation of entries through CalDAV.
https://jtx.techbee.at/
GNU General Public License v3.0
388 stars 10 forks source link

[Feature/Bug] Support rendering multiline Markdown code blocks #940

Open nomorsug opened 1 year ago

nomorsug commented 1 year ago

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

patrickunterwegs commented 1 year ago

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

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

nomorsug commented 1 year ago

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

quignogs commented 1 year ago

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.

rogercreagh commented 1 year ago

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.