Learn R Programming

automerge (version 0.3.0)

am_mark_clear: Clear marks from a text range

Description

Removes marks matching the given name from a range of text. This is the inverse of am_mark().

Usage

am_mark_clear(obj, start, end, name, expand = AM_MARK_EXPAND_NONE)

Value

The text object obj (invisibly)

Arguments

obj

An Automerge object ID (must be a text object)

start

Integer start position (0-based inter-character position, inclusive)

end

Integer end position (0-based inter-character position, exclusive)

name

Character string identifying the mark to clear (e.g., "bold")

expand

Character string controlling mark clearing behavior at boundaries. Options: "none" (default), "before", "after", "both". Use the constants AM_MARK_EXPAND_NONE, AM_MARK_EXPAND_BEFORE, AM_MARK_EXPAND_AFTER, or AM_MARK_EXPAND_BOTH.

Indexing Convention

Uses the same 0-based inter-character position indexing as am_mark().

See Also

am_mark(), am_marks()

Examples

Run this code
doc <- am_create()
am_put(doc, AM_ROOT, "text", am_text("Hello World"))
text_obj <- am_get(doc, AM_ROOT, "text")

# Add a mark
am_mark(text_obj, 0, 11, "bold", TRUE)
length(am_marks(text_obj))  # 1

# Clear the mark
am_mark_clear(text_obj, 0, 11, "bold")
length(am_marks(text_obj))  # 0

am_close(doc)

Run the code above in your browser using DataLab