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

Hyperlink support for cells #292

Merged
merged 3 commits into from Apr 5, 2022
Merged

Conversation

speedytwenty
Copy link
Collaborator

@speedytwenty speedytwenty commented Apr 5, 2022

This PR adds support for hyperlinks using a very simple interface. This feature was requested in #73

table.push([
  // Specify the URL as the display text
  { href: 'http://example.com' }, 
  // Specify display text
  { href: 'http://example.com', content: 'Example text' },
]);

Link text is wrapped, truncated, etc. as usual but when the text of a cell spans multiple lines, each line is wrapped with the link.

PR includes:

  • Added utils.hyplerink() with unit tests (with credits to @matheussampaio)
  • Added hyperlink support to Cell with functional tests that generate documentation
  • Updated documentation basic-usage.md

The difference in functionality is not meaningfully demonstrable in markdown. Examine the (failing/passing) tests in Checks to inspect the differences.

@speedytwenty speedytwenty linked an issue Apr 5, 2022 that may be closed by this pull request
@speedytwenty speedytwenty marked this pull request as ready for review April 5, 2022 03:47
@speedytwenty speedytwenty merged commit ed4afb7 into cli-table:master Apr 5, 2022
@speedytwenty speedytwenty added the enhancement New feature or request label Apr 5, 2022
@speedytwenty speedytwenty deleted the issue-73 branch April 16, 2022 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link as hyperlink in terminal doesn't render correctly
1 participant