Using markdown to ask questions with code in them

a) How do I get code in a question to look right for the reader?

For instance, if I needed to ask about this SQL command…


… what’s the best markdown approach? (I’ve enclosed it in … but used less-than and greater-than signs instead of the [ and ] used in this sentence. PLEASE tell me there’s a better way?? Or at least a way to use that lets me do a whole block of code with just one [code] at the start and one at the end… without losing the new-lines.

(For those who look at this in the future, here is the “backtick” answer,
in action… SELECT * FROM xact WHERE frm IS NULL (one at each end)

The following ONLY needed “indent each line by four spaces”…


b) Is there a way to look at the “raw” version of posted material, to learn from that??
(Answer was "No, not until you have enough karma points… lots… to be able to edit other people’s posts.)

Sometimes, I use to compose posts in Markdown. Try it maybe.

Preliminary remark: this question is about AskLO; it should have been tagged meta. common is for problems occurring in all applications of the suite. As an interesting exercice, retag to replace common with meta. You need to press Enter twice to exit retag mode.

The home page has a Ask on the TDF wiki link where the Formatting and Markup section gives a very succinct description of the use of the site. The important data is the link to Markdown on Wikipedia.

Basically, a question can be written in HTML. Markdown simplifies the job by offering shortcuts to frequent highlighting.

About code, there is no “best” approach. There are several ways of doing that. You mentioned HTML <code> … </code>. You can also use backticks to include a fragment of a line. When you have several lines, indent your “code” 4 spaces. It will be taken “as is”.

Learning by example is an excellent idea. The way to do it is to click on the edit link (of course, Cancel afterwards!). Unfortunately, to be able to edit others’ contributions, you need quite a lot of karma points.So, for the time being, your only possibility seems to read the “playground question” (see the link in the wiki page).

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

1 Like

Many thanks. I’d “up-vote you”, but don’t have enough karma even for that yet! (^_^) I had actually read both of the resources you suggest (!), but found both… wanting. While I am new to Ask.libreoffice, I have “been around” a long time… editing Wikipedia material, for instance, for over 15 years.

In particular, thank you for the answer to “how do I highlight code”! (And the guidance on “meta” vs “common”.)

You’re welcome.