I'd like to propose the following logic for handling this element:

# If the first brace is on the first column, and there are no non-whitespace characters after the last brace, then this element starts a block-level element.
# Otherwise, start a <span>.

The point is that I've found that my users often want to escape markup within a sentence, and the above rules seem to work well in that case.

Whether there is whitespace before the first brace is a matter of taste, I believe.

-- Janne Jalkanen, 31-Aug-2006


like this?
{{{

this is an example {{ ==h1, **bold** }} that starts a span
and this is an example as a block for sourcecode

{{
println 'hello world';
}}

}}}

This way we would not need seperate syntaxes for monospaced and preformatted

-- Christoph, 31-Aug-2006

Well, monospace is different from preformatted which is different from monowiki.  But essentially, yes.

-- JanneJalkanen

I agree with Janne. I'd phrase the rules differently, however:

# If the opening triple braces start on the first column, open a pre block. It is closed by closing triple braces starting on the first column.
# Any other opening triple braces open a span. They are closed by tripple braces.

This has the benefit that you can include the markup for unprocessed text inside the markup for preformatted text. Something I have wanted to do on this wiki several times!

The desired result is:

{{{
To produce bold text, use {​{​{**bold**}​}​}.
}}}

And not:

{{{
To produce bold text, use {{{**bold**}}}.
}}}

-- [AlexSchroeder]

!Collision with MediaWiki format parameters

Unfortunately &#123;&#123;{..&#125;&#125;} for preformatted text collides with MediaWiki template parameters, see [Creole Markup Collision Analysis]. Since MediaWiki is probably the most popular wiki of all this needs to be changed.

-- MartinBudden, 2006-12-28

So a single wiki engine uses markup conflicting with Creole for a feature pretty unique for it. That's unfortunate. What can we do?

Update:
After some reaserach on MediaWiki's templates, I think it's not that bad at all:
* Normal (non-template) pages can use monospaced text without problems
* Template pages can use the preformatted blocks normally
* Template pages can render inline {{{{{{...}} } }}} as nowiki text by default, with two exceptions:
** When there is only a number inside, and the page is being included as a template with at least that number of paramteres
** When there is a parameter name inside, and the page is being included as a template with that named parameter passed

It has two disadvantages:
* makes it harder to explain/understand the creating of templates -- but they are pretty advanced and rare feature anyways
* makes it a little harder to write (and maintain) the parser -- but that's something you do for a single wiki engine -- and at its cost you have a pretty popular and collision-free syntax in Creole. It's not me who is going to do that work, but I think it's worth it.
-- RadomirDopieralski, 2006-12-29

!Comments about preformatted text

Preformatted text is important for me, and is turning out to be quite tricky for a variety of reasons.

First, I need to handle inline comment enclosed in curly braces (this is a common notation in set theory, like {A, B}). So if I have four open curlies followed by four closes, how do I handle that? One provisional solution I'm considering is associating the extra close curlies with the ''inside'' of the span, so the regex for the closing markup is three closing curlies not followed by a fourth: {{\}\}\}(?!\})}} in Python syntax, for the coders out there. This would also provide an escape for three or more closing curlies inside a span: just follow those with three closing curlies followed by three opening ones, to open a new span.

Second, the 0.3 spec seems to indicate that wiki markup is processed inside the inline preformatted element. That would be a problem, because there's all kinds of stuff that might go in the tag, some of which might look like markup. Block elements clearly do not have their markup processed.

In any case, even if no wiki markup were allowed inside preformatted inline spans, it would be possible to get the bold preformatted effect by reversing the nesting of the markup, putting the bold on the outside and the pre on the inside (as a reminder of how tricky this is, I was not able to get a sample to render correctly in this Wiki engine).

Third, I'm currently using backslash to escape wiki markup (something often done with a <nowiki> tag). This will conflict with the proposed {{\}}{{\}} syntax for linebreaks. My current inclination is to remove it entirely, but that leaves me with no good way to indicate nowiki outside monospaced spans. A workable hack is to intersperse empty preformatted spans to break up what would otherwise be interpreted as markup.

-- [Raph Levien] 31 Dec 2006

For the first of your problems I can see two solutions. If it's only an occassional thing, then you can go with {{{{{{{A,B} ~}}}}}}. The extra space does look weird, but hopefully doesn't have a meaning in math language. The second solution, if the wiki site you use talks about math often, would be to intorudce an additional {{{$$...$$}}} markup (not part of the Creole, but Creole is extensible) for math, that would either use Latex or MathML for formatting, or just typeset the mathematical formulas with a distinct font (and of course escape the markup).

Second, obviously no markup should be interpreted inside "nowiki", except the three closing curly braces, and maybe an escape character, if we will have any. Of course, markup defined outside of the "nowiki" span, like lists, emphasis and tables, is still in effect.

Third, we still don't know what markup to use for the line ends. We are open to suggestions. "\\" is just one common solution, but I'm sure we can do better than that.

Thank you for your feedback, and please remember that Creole is supposed to be a "common part" of wiki markups (or an alternate input method), not necessarily the only markup available -- there are so many different use cases, that this woudn't be possible.

Btw, your idea with the closing curly braces is interesting -- I don't think it breaks anything, and it lets you write {{{{{{{{{...~}}}~}}}}}} without the need for escape characters or spaces -- I doubt anybody would need a "nowiki" span immediatelly followed by a curly brace.

-- RadomirDopieralski, 2006-01-01

One idea would be to extend Creole to have a [heredoc|EnWikipedia:Heredoc] style syntax. That way could vary the terminating token as needed. 

-- JaredWilliams, 2006-01-01

Isn't it a little complicated, and unfortunately, impossible to parse with regexps (ok, it's possible with perl's and python's regexp, by use of the python's {{{(?P=...)}}} for example). What's more, do we need/want to have Creole "complete", in the sense that every (valid) output is possible to achieve?

-- RadomirDopieralski, 2006-01-01

Its just a back reference isn't it? Something like {{{ /{{{(\w+)\n(.*)\n\1/ }}}. 
Obviously most Wiki's probably wouldn't need such a feature, therefore probably shouldn't be in Creole. But also offers a syntax for marking a range of text (if generalised further) to assign an identifier to a section of a page for transclusion.

-- JaredWilliams, 2006-01-01