Ask / Submit
1

How to insert terminal output into a question? [answered]

asked 2017-04-15 16:31:55 +0300

silta gravatar image

updated 2017-04-17 15:59:47 +0300

Hi,

I would like to insert terminal output in a separate textboxt into a question here at TJC, but I don't know how to do this.

Using the "preformatted text" button effects only to the first text line and the "quote" button breaks the line break.

Thanks.

edit retag flag offensive reopen delete

The question has been closed for the following reason "the question is answered, an answer was accepted" by silta
close date 2017-04-17 15:57:09.689013

2 Answers

Sort by » oldest newest most voted
2

answered 2017-04-15 17:36:19 +0300

Edz gravatar image

updated 2017-04-15 19:50:21 +0300

Inserting code here on TJC; yep, it doesn't always work and needs a little manual adjustment, plus if you are using a PC, you can see a preview below where you're typing.

So, drop a line, then click on the '101010' icon above to insert some code; The 'enter code here' message shows, highlighted in blue. place your cursor over the blue highlight, right click and paste your code;

     WeatherLoader {
     id: weatherWidget
     width: lockScreen.width
     active: true; enabled: true
     anchors {
         bottom: parent.bottom
         bottomMargin: Theme.paddingLarge
         horizontalCenter: parent.horizontalCenter
     }
 }

Drop another line here to 'move away' from your pasted code and it should look like the above. If it still isn't working, try moving each line in by one or two spaces, keep an eye on the preview below your text box, then you can see if formatting is working.

Have a look at this image, this is a screengrab of me actually creating this post, note the positioning and indent/alignment of the code, this can have the wrong effect on your text;

image description

edit flag offensive delete publish link more

Comments

Thanks for your answer, but unfortunately it deosn't work. It affects only to the first line, the rest is normal text without line breaks.

Strange: When I copy your code and try again, it works. What am I doing wrong?

silta ( 2017-04-15 18:14:12 +0300 )edit

Without actually watching you try it, I'm not sure what to say. Perhaps to check the formatting of the code you are pasting. It took me a while to work it out as well, it isn't totally intuitive, but keep playing about, you'll get it, I did, eventually.. I've added a screengrab to my original answer, check it out, it may help.

Edz ( 2017-04-15 19:45:37 +0300 )edit

I don't get any further. I will have a look at it later. For now I have a solution. I putted the terminal output into a text file and posted this. Thanks for your efforts. Have a nice weekend.

silta ( 2017-04-15 22:01:32 +0300 )edit

Your solution was probably the best one, as there is a fair bit of code. Otherwise, keep trying, especially if you only wish to display a snippet of code, like above. Regards,

Edz ( 2017-04-16 02:11:11 +0300 )edit

You can use html tag "pre"

BirdZhang ( 2017-04-16 04:21:28 +0300 )edit
0

answered 2017-04-16 15:19:23 +0300

silta gravatar image

Thanks to @fmotl and @BirdZhang this problem is solved

Solution one is as @fmotl discribed in his answer in this thread. In addition to that I had to edit my codeblock at first by adding four spaces on each line on the left, beginning with the second line.

Solution two as @BirdZhang said in his comment to @fmotl's answer. I had to insert HTML tag pre at the begin and /pre at the end of the text (it is admittedly easier...). Don't forget the less-than and the greater-than-sign .

Thanks.

edit flag offensive delete publish link more

Question tools

Follow
1 follower

Stats

Asked: 2017-04-15 16:31:55 +0300

Seen: 444 times

Last updated: Apr 17 '17