12. convert

Parameter syntax:

[ implicit_selection ]? [ S argument_node ]?

Converts text selection or selected nodes to argument node.

Unlike replace which creates an empty new element, convert transfers the content of the selection to the new element which is the result of the conversion.

More precisely, in the case of node selection:

Note that when argument node is an element template, command convert copies the attributes of the element template and ignores its child nodes.

Examples:

convert emphasis
convert [implicitElement] #text
convert #template({http://www.w3.org/1999/xhtml}span,highlight)

See also command wrap, a variant of command convert which has a different behavior in the case of single element selection.