Search code examples
wikiwiki-markup

Line breaks within indented <source> tag


I have not been able to find an answer to this anywhere.

I am working on an internal Wiki entry. I have code that I want to include inside a <source> tag. Because the <source> tag is inside a bulleted list, I want it indented.

Here's my problem: my code includes multiple lines, and I want to insert line breaks in the code example. But for whatever reason, Wiki markup won't let me do this.

When I try to insert a carriage return, the <source> formatting disappears for the new line.

When I try to insert a <br /> tag, the tag actually shows up; it does NOT break the line!

So far, the only workaround I've found is something like this -- which is NOT what I want!!!

:<source lang="sql">select * from table1</source>
:<source lang="sql">select * from table2</source>

NO!!! What I want is something like this:

:<source lang="sql">select * from table1
select * from table2</source>

--note the line break for the second SELECT statement!
--also note the ':' that indicates that I want it indented!
--when I try it this way, the <source> formatting for the second line disappears!
--I also tried adding the ':' to the second line -- that doesn't work, either!

I've also tried this, but it doesn't work, either!

:<source lang="sql">select * from table1<br />select * from table2</source>

--when I try this, the <br /> tag actually shows up; it does NOT break the line!

In other words, I want both individual lines to appear within the same indented <source> tag.

How do I get this to work?


Solution

  • I discovered that the answer is not to use Wiki markup for bullet lists at all. Instead, use HTML markup.

    Example:

    <ul>
       <li>list 1</li>
       <li>list 2
          <source lang="sql">select * from table1
          select * from table2</source>
       </li>
    </ul>
    

    As soon as I abandoned the Wiki markup method of using bulleted lists and indents, and instead used straight HTML, it did exactly what I wanted.