MediaWiki – Multi-Line <pre></pre> within List

July 14, 2010 at 21:03 (mediawiki, tutorial)

Background: MediaWiki is open source software used to create wikis; it was developed for and is currently used by Wikipedia. I am using version 1.15.4.

I’ve spent a lot of time searching without success for a way to insert a multi-line pre-formatted block of text within an ordered or unordered list in MediaWiki using wiki markup * and # syntax. Today I finally figured out this can be done using either &#10; (Line Feed) or &#13; (Carriage Return). I haven’t tested across platforms or browsers, but here is an example:

* Element A
* Element B
*# Element B.one
*# Element B.two <pre>Multi-line&#10;pre-formatted&#10;block</pre>
*# Element B.three
* Element C

which renders on my system as:

Multi-Line Pre-Formatted Text Example

3 Comments

  1. Dmitry said,

    Thanks, that helped me.

  2. Johnny said,

    Please delete my previous 3 comments

    <ol>
      <li> Item1 </li>
      <li> Item2
        <pre>
    Line 1
    Line 2
        </pre>
      </li>
    </ol>
    
    • dansesacrale said,

      I know you can use HTML for the list; the whole point of this post is to do it without HTML. Read carefully: “…using wiki markup * and # syntax”. You can call it an aesthetic concern. I find it surprising that there is no simple built-in way to accomplish this with wiki markup (to my knowledge, and at the time the post was made since I haven’t investigated since then). But the HTML way may help someone, so it’s worth noting; I probably should have done so originally. Thanks.

Leave a reply to Johnny Cancel reply