wdpr
    Preparing search index...
    • Merge and split paragraphs according to Wikidot's span_ and expr behaviors.

      This is the main post-processing entry point for paragraph restructuring. It performs two passes over the top-level element list:

      First pass: Split paragraphs at _splitByBlankLine spans and empty [[#expr ]] elements. A single input paragraph may become multiple output paragraphs.

      Second pass: Merge consecutive paragraphs around span_ markers. When a paragraph contains a span_ marker, it absorbs adjacent paragraphs (even those without span_). The merged content is unwrapped (no <p> tag), matching Wikidot's rendering behavior. Escaped spans (content after blank lines in span_) are extracted and placed outside the merged paragraph.

      Parameters

      • children: Element[]

        Top-level element array from the parser

      Returns Element[]

      Restructured element array with paragraphs merged/split as needed