[Discover] Add “Copy as Markdown” option for selected results#245545
[Discover] Add “Copy as Markdown” option for selected results#245545jughosta merged 15 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
jbudz
left a comment
There was a problem hiding this comment.
src/platform/test/moon.yml LGTM
AlexGPlay
left a comment
There was a problem hiding this comment.
i did some testing around different special characters inside the tables and everything worked fine
| const escapedText = text.replace(/\|/g, '\\|').replace(/\n/g, ' '); | ||
| const start = isFirst ? '|' : ' |'; | ||
| const end = isLast ? ' |' : ''; | ||
| return `${start} ${escapedText}${end}`; |
There was a problem hiding this comment.
not a 100% sure but i think the spaces are not mandatory between the content and the separators, so |a|, | a| or |a | are all the same
There was a problem hiding this comment.
Thanks!
In my opinion the readability of the copied output is better when it's with spaces.
| if (format === CopyAsTextFormat.tabular) { | ||
| expect(servicesMock.toastNotifications.addWarning).toHaveBeenCalledWith({ | ||
| title: 'Copied to clipboard', | ||
| text: 'Values may contain formulas that are escaped.', | ||
| }); | ||
| } else { | ||
| expect(servicesMock.toastNotifications.addWarning).not.toHaveBeenCalled(); | ||
| expect(servicesMock.toastNotifications.addInfo).toHaveBeenCalledWith({ | ||
| title: 'Copied to clipboard', | ||
| }); | ||
| } |
There was a problem hiding this comment.
nit: if we have conditions inside the test it might be better to just split them in 2 different ones
PhilippeOberti
left a comment
There was a problem hiding this comment.
Code review only, LGTM for the @elastic/security-threat-hunting-investigations team
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @jughosta |
…c#245545) - Closes elastic#239689 ## Summary This PR adds support for copying rows of data in Markdown table format. Please help with testing for some edge cases in field values. <img width="1459" height="395" alt="Screenshot 2025-12-08 at 16 52 55" src="https://github.com/user-attachments/assets/192e511e-82dc-478c-813f-441860fd2a06" /> ### Demo Example of using the copied value on Github as a comment: <img width="548" height="194" alt="Screenshot 2025-12-08 at 16 55 46" src="https://github.com/user-attachments/assets/813deaeb-5c24-40c5-9835-35fd04a8dfbf" /> <img width="601" height="229" alt="Screenshot 2025-12-08 at 16 53 33" src="https://github.com/user-attachments/assets/0b6e7668-ff7d-4390-9c6e-762bf8471494" /> ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
This PR adds support for copying rows of data in Markdown table format. Please help with testing for some edge cases in field values.
Demo
Example of using the copied value on Github as a comment:


Checklist
release_note:*label is applied per the guidelinesbackport:*labels.