Skip to content

Add a 'raw' argument to the template formatter for verbatim inserts#137

Merged
Amberg merged 1 commit into
Amberg:mainfrom
ds-o:feature/subtemplate-raw-mode
Jul 6, 2026
Merged

Add a 'raw' argument to the template formatter for verbatim inserts#137
Amberg merged 1 commit into
Amberg:mainfrom
ds-o:feature/subtemplate-raw-mode

Conversation

@ds-o

@ds-o ds-o commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

The :template / :T formatter runs the template engine over the inserted sub-document, so any {{ }} tokens or {{#..}} loops it contains are interpreted - and under SkipBindingAndRemoveContent unbound ones are silently removed. That corrupts documents that legitimately contain the template syntax as literal text, e.g. code samples or template-injection payloads embedded from an untrusted / user-authored source.

Add an optional 'raw' argument ({{.}:template('ds.Doc','raw')}) that inserts the sub-document verbatim, skipping template processing. It composes with the existing selector argument and still imports referenced parts (images, hyperlinks), so an inserted document keeps its images while its text is preserved literally.

Adds SubTemplateRawInsertTest.

The :template / :T formatter runs the template engine over the inserted sub-document,
so any {{ }} tokens or {{#..}} loops it contains are interpreted - and under
SkipBindingAndRemoveContent unbound ones are silently removed. That corrupts documents
that legitimately contain the template syntax as literal text, e.g. code samples or
template-injection payloads embedded from an untrusted / user-authored source.

Add an optional 'raw' argument ({{.}:template('ds.Doc','raw')}) that inserts the
sub-document verbatim, skipping template processing. It composes with the existing
selector argument and still imports referenced parts (images, hyperlinks), so an
inserted document keeps its images while its text is preserved literally.

Adds SubTemplateRawInsertTest.
@Amberg Amberg merged commit 92843c5 into Amberg:main Jul 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants