Skip to content

Add a :safetree format specifier #37

@davepeck

Description

@davepeck

The :safe format specifier treats safe content as text that does not need to be escaped:

body = '<p>hi</p>'
result = html(t'<div>{body:safe}</div>')
# result.children[0] is a `Text()` node whose content is "safe".

We'd also like for users to be able to say "treat this content as safe and parse it into a tree". Hence, :safetree:

body = '<p>hi</p>'
result = html(t'<div>{body:safetree}</div>')
# result.children[0] is a `Element(tag=p...)` node

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions