toSdl

fnstring toSdl(const ref CdmDocument doc, SdlWriteOptions opts = SdlWriteOptions.init) @safe

Serialize a CDM document to SDL text.

Preserves comments attached to nodes and uses format metadata (quote styles, raw text) when available for roundtrip fidelity.

Parameters

docThe document to serialize.
optsWriter options (indentation, formatting).

Returns

SDL text representation of the document.

Examples

auto doc = parseSdlCdm(`server host="localhost" port=8080`);
string output = toSdl(doc);
assert(output.canFind("server"));
assert(output.canFind(`host="localhost"`));
fnvoid toSdl(Out)(const ref CdmDocument doc, ref Out output, SdlWriteOptions opts = SdlWriteOptions.init) @safe

Output range variant of toSdl().