Method: Markly::Node#string_content=

Defined in:
ext/markly/markly.c

#string_content=(s) ⇒ Object

Public: Sets the string content of the node.

string - A String containing new content.

Raises Error if the string content can’t be set.



321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'ext/markly/markly.c', line 321

static VALUE rb_node_set_string_content(VALUE self, VALUE s) {
	char *text;
	cmark_node *node;
	Check_Type(s, T_STRING);

	TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
	text = StringValueCStr(s);

	if (!cmark_node_set_literal(node, text)) {
		rb_raise(rb_Markly_Error, "could not set string content");
	}

	return Qnil;
}