Help Needed on Markdown



  • Is there any method of adding a newline (line break) within a table?
    This Stack Overflow post suggests a few options, but none seem to work in these Vivaldi forums. Here's what I tried to no avail:

    • <br>
    • <br/>
    • \\
    • \n

    Here's a table showing how each of these options fail:

    header1<br>(units) header2<br/>(units) header3\(units) header4\n(units)
    data1 comment<br>data2 data3 data4

  • GNU/Linux Admin

    To be honest, I've never really been able to get line breaks working with our markdown tables. So I am not sure if it is possible at this time 😕


  • Plugin & Theme Dev Community Rep

    It is possible, but you need nodebb-plugin-markdown 8.11.1 or higher, while package.json has the exact version of this plugin selected, so unless you installed your NodeBB recently, you have to either upgrade NodeBB if you're on master branch (git fetch;git reset --hard origin/master;./nodebb upgrade), switch to master branch, wait for next minor 1.13 version or install it manually via npm install nodebb-plugin-markdown@latest - with the last option being the easiest.

    In that version a plugin for markdown-it was added that adds parts of multimarkdown syntax - specifically, better table syntax. You will be able to create multiline tables like this:

    | header1 | header2 | header3 | header4 |\
    | units   | units   | units   | units   |
    |:-------:|:-------:|:-------:|:-------:|
    | data1   | data2   | data3   | data4   | 
    

    When you add \ at the end of a row markdown parser will now interpret it as a multiline row and merge it with the one below. So this example table will look like this:
    multiline table example

    There is more to this syntax than just merging two rows (for example single cells spanning multiple rows or columns) and you can find the documentation of this plugin here



  • @oplik0 thanks a mil for this great input. 🙏 🙂


Log in to reply
 

Suggested Topics

  • 10
  • 19
  • 1
  • 7
  • 3
| |