From 3e65874acd8ed63a2ad330e447b0230e088d3866 Mon Sep 17 00:00:00 2001 From: Julien Falque Date: Sat, 1 Apr 2017 19:11:54 +0200 Subject: [PATCH 1/2] Add a note about escaping console format tags --- console/coloring.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/console/coloring.rst b/console/coloring.rst index 5ff947d1962..c27b310dc1d 100644 --- a/console/coloring.rst +++ b/console/coloring.rst @@ -65,6 +65,14 @@ You can also set these colors and options directly inside the tagname:: // bold text on a yellow background $output->writeln('foo'); +.. note:: + + If you need to render a tag literally, you must escape it with a backslash: ``\``. + You can use :method:`OutputFormatter::escape() ` + to escape all tags of a given text. + + If you need to render a literal backslash before a tag, replace it with ``<<``. + .. _Cmder: http://cmder.net/ .. _ConEmu: https://conemu.github.io/ .. _ANSICON: https://github.com/adoxa/ansicon/releases From a798c0e8af52a0409e5a9df84f797b5aaa09c288 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 15 Apr 2017 12:42:01 +0200 Subject: [PATCH 2/2] Minor reword --- console/coloring.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/console/coloring.rst b/console/coloring.rst index c27b310dc1d..034c339fd11 100644 --- a/console/coloring.rst +++ b/console/coloring.rst @@ -67,11 +67,9 @@ You can also set these colors and options directly inside the tagname:: .. note:: - If you need to render a tag literally, you must escape it with a backslash: ``\``. - You can use :method:`OutputFormatter::escape() ` - to escape all tags of a given text. - - If you need to render a literal backslash before a tag, replace it with ``<<``. + If you need to render a tag literally, escape it with a backslash: ``\`` + or use the :method:`Symfony\\Component\\Console\\Formatter\\OutputFormatter::escape` + method to escape all the tags included in the given string. .. _Cmder: http://cmder.net/ .. _ConEmu: https://conemu.github.io/