render
Render the settings as TOML, YAML, or JSON text.
-
FORMATS = ('toml', 'yaml', 'json')
Formats in which the example can be rendered.
-
render(settings: Sequence[Entry], fmt: str = 'toml') → str[source]
Render the example as plain text.
-
to_toml_value(value: Any) → str[source]
Render a JSON value as an inline TOML value.
>>> to_toml_value({"name": "demo", "paths": ["a", "b"], "strict": True})
'{ name = "demo", paths = ["a", "b"], strict = true }'
-
to_yaml_value(value: Any) → str[source]
Render a JSON value as a YAML flow value.
>>> to_yaml_value({"name": "demo", "paths": ["a", "b"], "strict": True, "v": "1.0"})
'{name: demo, paths: [a, b], strict: true, v: "1.0"}'