Skip to content

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)

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.

Value

The text object obj (invisibly)

Indexing Convention

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

See also

Examples

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)
am_marks(text_obj)
#> [[1]]
#> [[1]]$name
#> [1] "bold"
#> 
#> [[1]]$value
#> [1] TRUE
#> 
#> [[1]]$start
#> [1] 0
#> 
#> [[1]]$end
#> [1] 11
#> 
#> 

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

am_close(doc)