SamboyCoding / Tomlet

Zero-Dependency, model-based TOML De/Serializer for .NET
MIT License
155 stars 29 forks source link

[Suggestion] String serialization #18

Closed levicki closed 1 year ago

levicki commented 1 year ago

Please consider serializing strings that contain \ character as string literals (i.e. with single quotes):

FolderPath = 'C:\Path\To\Folder'

Currently they are escaped then serialized with regular double quotes.

Furthermore, if the strings contain newline characters (probably also taking into account Unicode newlines, not just \r and \n), they could be serialized using multi-line literals:

lines = '''
The first newline is
trimmed in raw strings.
All other whitespace
is preserved.
'''

If you want to avoid scanning strings and doing any auto-detection, then having some control over how string values are serialized would be nice.

levicki commented 1 year ago

Thanks for implementing this.