[HowTo] Post command output and file content as formatted text

Difficulty: ★☆☆☆☆

Formatting differences

  • Discourse – this forum’s engine – uses Markdown to format its posts, and removes “unnecessary” whitespace.
  • Terminal commands often produce output formatted so that they are better readable by the user, taking advantage of the monospaced font used.
  • Programming code often rely on indentation to make it more readable.

Using preformatting in Markdown

Markdown includes a pattern to provide preformatting when necessary.
You only need to put the part to format between two lines of three backticks, like so:

```
This text will be preformatted.
```

:warning: Do note confuse the backtick ` character with the single quote or double quote ".

:star: If you don’t find the backtick key on your keyboard, you can achieve the same result by clicking the Preformatted text </> button in the posting form, or with Ctrl+E.

:star: The posting form has a preview feature, allowing you to check whether you correctly set preformatting before posting.

:star: You can edit your own posts. Make use of this to correct the formatting when asked to.

Without preformatting:

$ inxi -m
Memory:
RAM: total: 15.64 GiB used: 6.51 GiB (41.6%)
RAM Report:
permissions: Unable to run dmidecode. Root privileges required.

With preformatting:

$ inxi -m
Memory:
  RAM: total: 15.64 GiB used: 6.51 GiB (41.6%)
  RAM Report:
    permissions: Unable to run dmidecode. Root privileges required.
15 Likes

You can also use Ctrl + E on keyboard

Or 4 spaces at the start of a line

3 Likes

HTML can be used as well:

<pre><code>
type or paste code here
</code></pre>

4 Likes

I found these resources helpful to learn about markdown, discourse, and the Manjaro forum.

You are only able to do that when you have the permissions, on the forum, to edit posts of others… (Which most users of the forum do not have)
But there is an easier way that works for all:

  • Select the part of the post you want to investigate in the post, then there should popup a “Quote” option you can click.
    Look at the quoted text the forum software prepared as your reply without posting that reply. :vulcan_salute:

I think something changed along the way. Don’t know when, why, or how. Anything I write would be a guess on my part. For example, most recently, I use to be able to create a poll, but I can’t any more. When I clicked the gear in the menu, there would be an item for it. Now there isn’t. Okay. :person_shrugging: It’s a little confusing because the discobot tutorial still demos creating a poll.

Thats because of trust level of the user account on the forum :wink:

Agree. Trust Level.

But, I don’t think it is documented what one can and cannot do, or how or something like that — and that is by design according to the folks at Discourse. Don’t want folks gaming the system. Argh :crazy_face: Not a big badge fan. But what stuck in my craw was, one day it disappeared. Don’t know. Maybe it was a bug fix or adm change. A lot of things change on the forum without notice, so I figured it is what it is, "c’est la vie.

I think a worthwhile addition to the OP guide would be to set the display language of the software the poster is using to English, via presetting the environment variables in case of command-line:

$ LANG=C LC_ALL=C your_command

or via GUI settings for screenshots. This saves the time of the helpers to
translate things to English. This is mentioned in the Pasting code and log file contents section of Manjaro Forum Rules, but every now and then I see command outputs not following this rule, which is fine on the respective Language-dedicated subforums but a bit counterproductive in general forum parts.