Hello!
tl;dr: Adjacent listblock and preformatted blocks mangle each other. What can I do to make listblock and preformatted properly handle the transition, just like they do with any other transition besides listblock/preformatted?
I'm using DokuWiki for IT documentation. That means that I interleave lots of verbal-type instructions structured in lists with lots of preformatted code/commands to cut and paste. I do this type of structure a lot:
Once the environment is ready, we are now going to create a widget:
* Start the Builder program
* Click the Create button
* Paste the following text in the Command box:
make --color blue --size large widget
* Paste the following text in the Description box:
I'm creating a large blue widget.
* Click ''Energize!''
* Close the program
Notice that there are exactly two spaces before the "make" text. That should cause it to be in a preformatted block. But it doesn't: it's the same plain-text non-list format as if the two spaces weren't there -- but if you check the HTML-rendered page source you'll see the two spaces are right there. But the following text is not rendered as a preformatted block.
There is other weirdness. If I were to put a blank line above the "make" text, the preformatted text works. But then, the next line, which is supposed to be a bulleted list, shows up as a continuation of the code block! I then have to put another blank line between the preformatted text and the next bulleted list entry. That makes for a lot of extraneous vertical space that has nothing to do with the actual needs of the instructions, which makes it very difficult to follow..
The problem is I do this all the time. It seems it's only listblock and preformatted that collide. So far, I have to use <code></code> for the preformatted text, but typing that over and over gets really old. In addition, half the time I'm actually working from the edit screen (so I can update things as I go along) and having to dance around <code></code> when cutting and pasting is also difficult and annoying: leading spaces are nearly always ignored, which would normally make life much easier!
What can I do to make listblock and preformatted understand each other's transition, just like they do with all the other parser transitions?
Here's my total wild guess: maybe because of the desire to coalesce consecutive lines of listblock or preformatted into a single parsing unit, it seems that either parsing pattern grabs more of the markup text than it should, maybe because they both use "\n " as part of their pattern -- other parsing patterns that don't depending on "\n " don't seem to be affected by this. In any case, the parser is prevented from properly handling the change from a listblock to a preformatted list or vice-versa.
I did dig into the regexes in inc/Parsing/ParserMode (Preformatted.php and Listblock.php). It seems like each of them should stop the match at the "\n" at the end of the line, and not interfere with the next parsing pattern. I haven't been able to dig into how ParallelRegex might change this, or maybe there is another part of the code I haven't seen that might be doing more coalescing of adjacent parsing modes.
What can I do to resolve this? Thank you for your attention. I greatly appreciate your help!