From ff459067bd02e80dc399006bb610238223d41c50 Mon Sep 17 00:00:00 2001 From: Daniel Sipka Date: Mon, 1 Feb 2016 21:08:46 +0100 Subject: [PATCH] custom escape function docs --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index ccb45aa..f39983e 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,22 @@ Output: 3: Scott ``` +### Custom escape function + +By default, mstch uses HTML escaping on the output, as per specification. This +is not useful if your output is not HTML, so mstch provides a way to supply +your own escape implementation. Just assign any callable object to the static +`mstch::config::escape`, which is an initially empty +`std::function`. + +For example you can turn off escaping entirely with a lambda: + +```c++ +mstch::config::escape = [](const std::string& str) -> std::string { + return str; +}; +``` + ## Requirements - A C++ compiler with decent C++11 support. Currently tested with: