8000 [Console] Add markdown format to Table · iMi-digital/symfony-docs@92dcddc · GitHub
[go: up one dir, main page]

Skip to content

Commit 92dcddc

Browse files
committed
[Console] Add markdown format to Table
Closes symfony#20653
1 parent 85b4530 commit 92dcddc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

components/console/helpers/table.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,27 @@ The table style can be changed to any built-in styles via
181181
// same as calling nothing
182182
$table->setStyle('default');
183183

184-
// changes the default style to compact
184+
// changes the default style to markdown
185+
$table->setStyle('markdown');
186+
$table->render();
187+
188+
This output the table in the Markdown format:
189+
190+
.. code-block:: terminal
191+
192+
| ISBN | Title | Author |
193+
|---------------|--------------------------|------------------|
194+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
195+
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
196+
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
197+
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
198+
199+
You can also set the style to ``compact``::
200+
185201
$table->setStyle('compact');
186202
$table->render();
187203

188-
This code results in:
204+
which outputs:
189205

190206
.. code-block:: terminal
191207

0 commit comments

Comments
 (0)
0