Also, this code block was taken directly from the library. That means this code is prone to change, and is also very complicated and missing context.

A better example would be something really short, like 2-3 lines of code max, showing how to accomplish some specific use case.

For example, there are two use cases shown here: One is reading a line of text from a buffer, and the other is replacing one substring with a different one.

A user of the application is not going to care about the webvtt_string_getline stuff, it's basically an internal function. I'm not sure the C++ interface even has a method for it. They might want to use the replace or replace_all functions, though. So it would be better to just give some simple examples of their use. There are examples in the string unittests that are short enough to show how to use the functions.