Skip to content
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

Generate tables in a markdown compatible format #71

Open
tomzx opened this issue Jul 12, 2015 · 3 comments
Open

Generate tables in a markdown compatible format #71

tomzx opened this issue Jul 12, 2015 · 3 comments

Comments

@tomzx
Copy link
Owner

tomzx commented Jul 12, 2015

Since I will be analyzing the issues that should be fixed to make php-semver-checker more useful and correct, I plan on writing down in case analysis issues what the incorrectly suggested changes are.

The current table format does not display well at all in markdown.

Compare

+-------+----------------------------------------------------------+-------------------------------------------------------+---------------------------------+------+
| Level | Location | Target | Reason | Code |
+-------+----------------------------------------------------------+-------------------------------------------------------+---------------------------------+------+
| MAJOR | src/Symfony/Component/Console/Style/SymfonyStyle.php:334 | Symfony\Component\Console\Style\SymfonyStyle::writeln | [public] Method has been added. | V015 |
| MAJOR | src/Symfony/Component/Console/Style/SymfonyStyle.php:343 | Symfony\Component\Console\Style\SymfonyStyle::write | [public] Method has been added. | V015 |
| MAJOR | src/Symfony/Component/Console/Style/SymfonyStyle.php:352 | Symfony\Component\Console\Style\SymfonyStyle::newLine | [public] Method has been added. | V015 |
+-------+----------------------------------------------------------+-------------------------------------------------------+---------------------------------+------+

to

Level Location Target Reason Code
MAJOR src/Symfony/Component/Console/Style/SymfonyStyle.php:334 Symfony\Component\Console\Style\SymfonyStyle::writeln [public] Method has been added. V015
MAJOR src/Symfony/Component/Console/Style/SymfonyStyle.php:343 Symfony\Component\Console\Style\SymfonyStyle::write [public] Method has been added. V015
MAJOR src/Symfony/Component/Console/Style/SymfonyStyle.php:352 Symfony\Component\Console\Style\SymfonyStyle::newLine [public] Method has been added. V015

In the best case, it is a matter of playing with the style of the Symfony Console. In the worst, it would require writing a new table generator.

@nochso
Copy link
Contributor

nochso commented Jan 20, 2016

I just gave this a try. This is what's preventing me: https://github.com/symfony/console/blob/master/Helper/Table.php#L261-L276

Note the calls to renderRowSeparator. For valid markdown tables you need to suppress the very first and last separators. The one right after the header has to be kept. The method is public, but it calls private methods..

@nochso
Copy link
Contributor

nochso commented Jan 20, 2016

Unless you have any ideas, I wouldn't mind writing my own implementation. Excluding col/row spans, pretty sure MD doesn't support that anyway.

@tomzx
Copy link
Owner Author

tomzx commented Jan 20, 2016

@nochso You could probably inherit from the TableHelper and rewrite the render function or possibly create a new method like "renderMarkdown" from that same inherited class.

Although my first idea would be to find a way to make Symfony's TableHelper be able to render to markdown out of the box.

Edit: I submitted symfony/symfony#17466. If it gets around being done, we could simply use the markdown style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants