-
Notifications
You must be signed in to change notification settings - Fork 43
Highlighting Lines in Codes
novoio edited this page Aug 11, 2020
·
2 revisions
Particular lines of codes can be highlighted by adding {:pre data-line="[line#3],[line#6]-[line#8]"} just before a code-block.
For example:
{:pre data-line="4-8,11,14-15"}
```cpp
int
main()
{
asio::io_context ioc;
auto exec = ioc.get_executor();
auto in = asio::posix::stream_descriptor(exec, ::dup(STDIN_FILENO));
auto out = asio::posix::stream_descriptor(exec, ::dup(STDOUT_FILENO));
async_copy_all(in, out, [](auto&& ec, auto total){
std::cout << "\ntransferred " << total << " bytes\n";
if (ec.failed())
{
std::cerr << "transfer failure: " << ec.message() << std::endl;
std::exit(ec.value());
}
});
ioc.run();
return 0;
```
This is how the above one will be rendered like:
