Nothing critical about this question, but let's say I have a query...
select *
from table
where formatting = 'well-nigh';
NOTE: I'm including some screenshots from dba.se.com as I don't think dba.meta.se.com sets color within code blocks, by default.
<screenshot with proper coloring taken from dba.se.com>
</screenshot>
... and I want to include it within a list of instructions:
- Try this query
- Or try this query
How do I intermingle these two markup items so they are formatted properly together? I'm not seeing a way to do it within the editing help page, and none of the ways I've tried are able to render the list and include the code (with proper coloring) appropriately.
Here are examples of what I've attempted so far. For instance, the following code mashes both markdown approaches together without much finesse...
1. Try this query:
select *
from table
where formatting = 'well-nigh';
2. Or try this query:
select *
from table
where formatting = 'well-nigh';
...which results with the list rendering properly, but not the code:
Try this query:
select * from table where formatting = 'well-nigh';
Or try this query:
select * from table where formatting = 'well-nigh';
I could nest the code within backticks (`)...
1. Try this query:
`select *
from table
where formatting = 'well-nigh';`
2. Or try this query:
`select *
from table
where formatting = 'well-nigh';`
..but it doesn't do so well with multi-line code-blocks nor does this approach render the color properly either:
Try this query:
select * from table where formatting = 'well-nigh';
Or try this query:
select * from table where formatting = 'well-nigh';
So I'm left with <pre>
...
1. Try this query:<pre>select *
from table
where formatting = 'well-nigh';</pre>
2. Or try this query:<pre>select *
from table
where formatting = 'well-nigh';</pre>
...which may be the saving grace here...
- Try this query:
select * from table where formatting = 'well-nigh';
- Or try this query:
select * from table where formatting = 'well-nigh';
...BUT the <pre>
elements do not enable the coloring like I would get within a normal (indented) code block, which you can see from the following screenshot:
<screenshot with (lack of) coloring taken from dba.se.com>
</screenshot>
I'm fine sticking with the <pre>
tags whenever I want to take this approach within a post, but is there a better way to do this that retains the formatting of the list items and code and also includes the appropriate coloring?
Final note on this: I'm posting this on dba.meta.se.com instead of meta.se.com as I believe the markdown parsers differ between the various SE communities, but please let me know if I'm mistaken.