imathis/octopress — pull request #814 by hamstergene (2012-11-16 08:37:01+00:00)
Title: Backtick code in lists

This patch allows to include backtick code blocks into ordered lists without breaking numbering. There was an issue #488 about this but it was closed.

The idea is to replace the highlighted html with base64 encoded plain-text blob with same indentation. Blob are surrounded by control UUIDs which help to find them back. For Markdown parser each blob looks like a simple word, and after P or LI tags are produced around it, it is decoded back to html.

Here are some test cases:

```m
NSLog(@"simple top level");
```

0. one
BBBBB
```m
NSLog(@"inside list, no indent");
a c;
d && e;
```

0. continue numbering
BBB
```m
NSLog(@"inside list, one-space indent");
```

0. continue numbering
BBB
```m
NSLog(@"inside, list 4-space indent");
```

0. continue numbering

```m
NSLog(@"inside list, separate 4-space indented paragraph");
```

0. continue numbering

```m
NSLog(@"outside of list (must BREAK the numbering)");
```

0. One again

I took a quick look for whether I can extend this for Liquid blocks, but didn't find neither how to guess their initial indentation nor any kind of post-render event. Also nothing is done when `-raw` flag is present as I don't completely understand what it's for.