Skip to content

Commit 696a436

Browse files
committed
docs: safeString javadoc
fix #388
1 parent e208357 commit 696a436

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

include/mrdox/Support/Handlebars.hpp

+15-18
Original file line numberDiff line numberDiff line change
@@ -1191,36 +1191,33 @@ isEmpty(dom::Value const& arg);
11911191
execution. For example, the each iterator creates a single
11921192
frame which is reused for all child execution.
11931193
1194-
@param arg The value to test
1195-
@return True if the value is empty, false otherwise
1194+
@param parent The underlying frame object
1195+
@return The overlay object
11961196
11971197
@see https://mustache.github.io/mustache.5.html#Sections
11981198
*/
11991199
MRDOX_DECL
12001200
dom::Object
12011201
createFrame(dom::Object const& parent);
12021202

1203-
/** Create child data objects.
1203+
/** Create a wrapper for a safe string.
12041204
1205-
This function can be used by block helpers to create child
1206-
data objects.
1207-
1208-
The child data object is an overlay frame object implementation
1209-
that will first look for a value in the child object and if
1210-
not found will look in the parent object.
1205+
This string wrapper prevents the string from being escaped
1206+
when the template is rendered.
12111207
1212-
Helpers that modify the data state should create a new frame
1213-
object when doing so, to isolate themselves and avoid corrupting
1214-
the state of any parents.
1208+
When a helper returns a safe string, it will be marked
1209+
as safe and will not be escaped when rendered. The
1210+
string will be rendered as if converted to a `dom::Value`
1211+
and rendered as-is.
12151212
1216-
Generally, only one frame needs to be created per helper
1217-
execution. For example, the each iterator creates a single
1218-
frame which is reused for all child execution.
1213+
When constructing the string that will be marked as safe, any
1214+
external content should be properly escaped using the
1215+
`escapeExpression` function to avoid potential security concerns.
12191216
1220-
@param arg The value to test
1221-
@return True if the value is empty, false otherwise
1217+
@param str The string to mark as safe
1218+
@return The safe string wrapper
12221219
1223-
@see https://mustache.github.io/mustache.5.html#Sections
1220+
@see https://handlebarsjs.com/api-reference/utilities.html#handlebars-safestring-string
12241221
*/
12251222
MRDOX_DECL
12261223
detail::safeStringWrapper

0 commit comments

Comments
 (0)