xnl-core 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -713,9 +713,9 @@ function serializeTextElement(node, state) {
713
713
  ` ?${marker}>`
714
714
  ].join("");
715
715
  const text = node.text ?? "";
716
- const textLines = text.length > 0 ? text.split(/\r?\n/).map((line) => `${state.indent.repeat(state.depth + 1)}${line}`) : [];
717
- const close = `${pad(state)}</?${marker}>`;
718
- return [`${pad(state)}${open}`, ...textLines, close].join("\n");
716
+ const currentPad = pad(state);
717
+ const alignedText = text.replace(/\r?\n/g, (lineBreak) => `${lineBreak}${currentPad}`);
718
+ return `${currentPad}${open}${alignedText}</?${marker}>`;
719
719
  }
720
720
  function serializeDataElement(node, state) {
721
721
  const open = [