Skip to content

Commit 3e65874

Browse files
committed
Add a note about escaping console format tags
1 parent f3eaa80 commit 3e65874

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

console/coloring.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ You can also set these colors and options directly inside the tagname::
6565
// bold text on a yellow background
6666
$output->writeln('<bg=yellow;options=bold>foo</>');
6767

68+
.. note::
69+
70+
If you need to render a tag literally, you must escape it with a backslash: ``\<info>``.
71+
You can use :method:`OutputFormatter::escape() <Symfony\\Component\\Console\\Formatter\\OutputFormatter::escape>`
72+
to escape all tags of a given text.
73+
74+
If you need to render a literal backslash before a tag, replace it with ``<<``.
75+
6876
.. _Cmder: http://cmder.net/
6977
.. _ConEmu: https://conemu.github.io/
7078
.. _ANSICON: https://github.com/adoxa/ansicon/releases

0 commit comments

Comments
 (0)