How can I create a numbered list containing multi line pre, source or code tags without breaking the list?

That is what I have been trying:

# First
# Second <source lang="CSharp">Some
Line C Sharp
Code </source>
# Trid

It results in something like:

Broken numbered list

2 Answers 2


The other answer is incorrect. This can be done using the line option:

# First
# Second <source line lang="CSharp">Some
Line C Sharp
Code </source>
# Third

Look, the output is correct: https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=1915324


I don't think that can be done with pure wiki markup. From the lists help page on mediawiki.org:

For simplicity, list items in wiki markup cannot be longer than a paragraph. A following blank line will end the list and reset the counter on ordered lists. Separating unordered list items usually has no noticeable effects.

Paragraphs can be forced in lists by using HTML tags. Two line break symbols, <br /><br />, will create the desired effect. So will enclosing all but the first paragraph with <p>...</p>

This works for normal paragraphs, but not for multiline code blocks because they need actual newlines.

However, MediaWiki does support some HTML tags, including <ol> and <ul>, so you can obtain the desired affect using HTML markup, like so:

<source lang="CSharp">Some
Line C Sharp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.