You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switch flow and block style dynamically depending on context (e.g. object path).
Try to keep lines within a target width.
I don't know how to get this done:
A simple way would be:
Register a callback on every value. Check or infer path to decide the style.
How to register such kind of callback? TypeConverter does not provide contextual info.
Try to serialize value with desired style.
How to try serialize value with specified style?
Emitter.Emit have style argument, but emit seems to be final.
Create another serializer? But serialization might be different (if not plain data), and quite verbose (Because serializer does not have a style argument, it would need another couple of TypeConverter or TypeResolver to enforce styles).
Check or estimate line width from serialized value, and maybe fallback to block style, or request wrap-around.
Is line width or line-wrap supported?
In js-yaml, it is simple to get a limited workaround.
replacer(key, value) callback is invoked on every value, and thus object path can be kept track of.
serialize API has a flowLevel option, so try serialize is another serialize call.
Downsides:
Another serialize -> different serialization.
Line-wrap cannot be done.
The text was updated successfully, but these errors were encountered:
My goal:
I don't know how to get this done:
A simple way would be:
How to register such kind of callback? TypeConverter does not provide contextual info.
How to try serialize value with specified style?
Emitter.Emit have style argument, but emit seems to be final.
Create another serializer? But serialization might be different (if not plain data), and quite verbose (Because serializer does not have a style argument, it would need another couple of TypeConverter or TypeResolver to enforce styles).
The text was updated successfully, but these errors were encountered: