veged / shmakowiki

Yet another wiki dialect, inspired by WackoWiki and WikiCreole
http://clubs.ya.ru/4611686018427414227/
13 stars 4 forks source link

Two cases of listItem content #21

Open diunko opened 11 years ago

diunko commented 11 years ago

With a bit of thought, how should blocks inside lists behave?

Let us consider two simple cases of listItem content:

  1. When there's nothing more in listItem except inline content:
   * something

listItem translates to a simple <li>something</li>.

  1. When there's one or more blocks following listItem inline content, like this:
     * item1
        %%hljs
          something();
        %%

or this:

      * item1

        item1 para2

        item1 para3
        %%hljs
          something();
        %%
      * item2
      * item3

First inline content gets wrapped into para, forming first block, and with all other blocks forms a list of children of listItem:

          ...
          ["ulistItem",
           [["para",["item1"]],
            ["para",["item1 para2"]],
            ["para",["item1 para3"]],
            ["extension","hljs","something();",""]]]
          ...

so the second case is effectively a list of block-level elements inside a listItem.

diunko commented 11 years ago

It seems that these two cases cover all useful blocks-inside-lists combinations.

To enable highlighting of list items' headers, let's allow headers inside list items (which are perfectly valid and commonly found in the wild).

To enable the second case, we have to allow empty lines not to break lists. The good question is, how do we terminate lists then?

I have some work in progress on these, which will land here as soon as we agree on acceptable blocks behavior.

arikon commented 11 years ago

@veged Need your opinion

veged commented 11 years ago

Initially I don't aim to be able use any block-level elements inside of listItem except sublists. The biggest problem is extensions, which must allow any text-based format inside %% and it's contrary to need for indentation all new lines inside of listItem.

But now, I think we can require to indent content of extensions for constant count of spaces for correct listItem indentation and automatically exclude this indent from text that passed to extension handler.

So we be able to make block level elements inside of listItem. But I'm still not sure about headers -- I think it's not so normal to put headers inside of lists (in semantic terms). Although we can just support this possibility.

diunko commented 11 years ago

Fine, I think I'll just put it here quite soon and we all see what happens then.

arikon commented 11 years ago

Should we close it or fix and merge?

diunko commented 11 years ago

Fix, definitely. Why not?​