Skip to content

Instantly share code, notes, and snippets.

@bmaggard
bmaggard / literal_string.py
Created February 12, 2023 00:40 — forked from paulkernstock/literal_string.py
Literal block scalars with PyYAML's dump
import yaml
from yaml.representer import SafeRepresenter
class LiteralString(str):
pass
def change_style(style, representer):
def new_representer(dumper, data):
scalar = representer(dumper, data)