Skip to content

[Console] Add markdown format to Table #20654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions components/console/helpers/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,27 @@ The table style can be changed to any built-in styles via
// same as calling nothing
$table->setStyle('default');

// changes the default style to compact
// changes the default style to markdown
$table->setStyle('markdown');
$table->render();

This outputs the table in the Markdown format:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This outputs the table in the Markdown format:
The output of this command will be:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to put some emphasis on that it supports Markdown format ... what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think it's not a bad idea to emphasize this, so I merged it "as is". Thanks.


.. code-block:: terminal

| ISBN | Title | Author |
|---------------|--------------------------|------------------|
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
| 80-902734-1-6 | And Then There Were None | Agatha Christie |

You can also set the style to ``compact``::

$table->setStyle('compact');
$table->render();

This code results in:
which outputs:

.. code-block:: terminal

Expand Down