python-poetry/tomlkit

Can I use tomlkit to dump a multi-line string?

Closed this issue · 1 comments

Is it possible to use tomlkit to create a toml document which contains a real multi-line string, like e.g.

mystr="""Some
content"""

Using toml, the content is automatically converted to a single line string
mystr="Some\\ncontent"

Thanks for all kind of hints!

In [1]: from tomlkit import document, string

In [2]: d = document()

In [3]: d['a'] = string("hello\nworld", multiline=True)

In [4]: print(d.as_string())
a = """hello
world"""