Any better way to create MediaWiki numbered lists?

后端 未结 11 895
梦如初夏
梦如初夏 2021-02-01 13:09

When using MediaWiki\'s markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this:



        
相关标签:
11条回答
  • 2021-02-01 13:40

    From the Wiki Help Page I was able to get the numbering in a list to stay consitant using <p> and <pre>:

    # Item 1
    # Item 2 <p><pre>Item 2 Pre Stuff</pre></p>
    # Item 3
    

    Would generate

    1. Item 1
    2. Item 2
       [ Item 2 Pre Stuff ]
    3. Item 3
    
    0 讨论(0)
  • 2021-02-01 13:44

    "#:" will not work with other tags like

    <source lang=javascript>
    //...
    </source>
    
    0 讨论(0)
  • 2021-02-01 13:50

    You can do:

    # one
    # two<br />spanning more lines<br />doesn't break numbering
    # three
    ## three point one
    ## three point two
    

    Regular old <br> works as well but probably pisses off someone.

    You can put additional HTML formatting in as well to do <pre> formatting and the like without breaking the numbering as well. This also works other list formats.

    From: http://www.mediawiki.org/wiki/Help:Formatting

    0 讨论(0)
  • 2021-02-01 13:51

    Like this:

    #Item1
    #:Somestuff
    #Item2
    
    0 讨论(0)
  • 2021-02-01 13:52

    There are a couple of options, but you can start an ordered list from an arbitrary number like this:

    #Item1
    
    Something
    
    <ol start="2">
    #Item2
    </ol>
    

    You can also use "#:" if you don't mind "Something" being indented a lot:

    #Item1
    #:
    #: Something
    #:
    #Item2
    

    There are quite a lot of options with lists, you can find more info on Wiki's Help Pages:List.

    update

    Newer version work more like regular html markup the old syntax will now give you a double indent and will not adjust the start offset, but the following works well, even with the source/syntaxhighlight tag.

    <ol>
    <li>Item1</li>
    Something
    </ol>
    
    <ol start="2">
    <li>Item2</li>
    <source lang=javascript>
    var a = 1;
    </source>
    </ol>
    

    In short everything within the ol tag will have the same indentation and will not be numbered if it is outside a li tag. The following will now work and it mean you don't have to offset groups manually.

    <ol>
    <li>Item1</li>
    Something
    <li>Item2</li>
    <source lang=javascript>
    var a = 1;
    </source>
    </ol>
    
    0 讨论(0)
  • 2021-02-01 13:54

    And for cases where you want to have some block text within your numbered wiki list try this

    # one
    #:<pre>
    #:some stuff
    #:some more stuff</pre>
    # two
    

    Which produces:

  • 1. one
       some stuff
       some more stuff
  • 2. two

0 讨论(0)
提交回复
热议问题