@gmb/bitmark-parser - v7.21.2
    Preparing search index...

    Function convertWithDetails

    • convert, returning the output together with the extras asked for (PLAN-221) — bitSpans: where each top-level bit's text is in the input and in the output (PLAN-223), for linking the panes that show them bit by bit; bitAnchors: fixed points inside each bit (PLAN-266), for keeping them linked inside long bits. The conversion runs once; output is exactly what convert returns for the same input and options, and it throws exactly as convert does.

      Spans are reported for the document outputs — "bitmark", "json" (compact or pretty), "text" and the markup formats ("html", "xml", …), from any input format. A span covers the bit's text only, on either side: never the separators between bits, nor the JSON array's [ / ].

      Parameters

      Returns ConvertResult

      A ConvertResult.

      const { output, bitSpans } = convertWithDetails(source, {
      inputFormat: "bitmark",
      outputFormat: "html",
      bitSpans: true,
      });
      for (const { index, inputStart, inputEnd, outputStart, outputEnd } of bitSpans!.spans) {
      console.log(index, source.slice(inputStart, inputEnd), output.slice(outputStart, outputEnd));
      }